Commit e4340b13 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: operation: fix incoming-response corruption



Make sure not to update the response message buffer for an operation
that is already scheduled for completion.

Currently if we get two incoming responses with the same id, the second
one would overwrite the response message buffer.

Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 048a7ffe
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -796,11 +796,12 @@ static void gb_connection_recv_response(struct gb_connection *connection,
	/* We must ignore the payload if a bad status is returned */
	if (errno)
		size = sizeof(*message->header);
	memcpy(message->header, data, size);

	/* The rest will be handled in work queue context */
	if (gb_operation_result_set(operation, errno))
	if (gb_operation_result_set(operation, errno)) {
		memcpy(message->header, data, size);
		queue_work(gb_operation_workqueue, &operation->work);
	}

	gb_operation_put(operation);
}