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

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
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment