greybus: short message is OK for errors
authorAlex Elder <elder@linaro.org>
Tue, 2 Dec 2014 14:30:29 +0000 (08:30 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 2 Dec 2014 22:35:33 +0000 (14:35 -0800)
commitf71e1cc1944d0a82aff032acd9bb25dff5187d37
tree180396d507844c3dacec795822bdb799f1ae87af
parent34db1f91e674ba8c7df674ac6692c2604ea1ece5
greybus: short message is OK for errors

We enforce a rule that a response message must completely fill the
buffer that's been allocated to hold it.  However, if an error
occurs, the payload is off limits, so we should allow a short
message to convey an error result.

Change gb_connection_recv_response() to require the right message
size only if there's no error.

One other thing:  The arriving data is only being copied into the
response buffer if the request was successful.  That means the
response message header is assumed to have been initialized.  That
isn't a valid assumption.  So change it so that if an error is
seen, the header portion of the message is copied into the
response buffer--but only the header.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c