Commit 8d55f4c6 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: complete overflow responses

If a response arrives for an operation request and the allotted
buffer isn't big enough we report the error, but we don't finish
processing the response.

Instead, set the operation result, but then finish processing
the response (no different from any other operation error).

This will allow the normal completion handling to occur for
this error case.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e8b48d15
......@@ -526,15 +526,14 @@ static void gb_connection_recv_response(struct gb_connection *connection,
gb_pending_operation_remove(operation);
message = &operation->response;
if (size > message->buffer_size) {
operation->result = GB_OP_OVERFLOW;
gb_connection_err(connection, "recv buffer too small");
return; /* XXX Should still complete operation */
}
/* The status in the response is the result of the operation */
if (size <= message->buffer_size) {
/* Transfer the operation result from the response header */
header = message->buffer;
operation->result = header->result;
} else {
gb_connection_err(connection, "recv buffer too small");
operation->result = GB_OP_OVERFLOW;
}
/* We must ignore the payload if a bad status is returned */
if (operation->result == GB_OP_SUCCESS)
......
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