greybus: sdio: error out only for smaller payloads received

This change “greybus: sdio: error out only for smaller payloads received” in Linux kernel is authored by Viresh Kumar <viresh.kumar [at] linaro.org> on Sat Aug 8 08:09:32 2015 +0530.

greybus: sdio: error out only for smaller payloads received

!= was used in place of <, while comparing expected and actual payload
size. The module may be running a higher version of the protocol and
might have some extra fields (towards the end) in the structure, and the
AP needs to ignore them.

This also updates the print (expected-payload-size <
actual-payload-size), when the size doesn't match for requests received
by the module. This gives more details required for debugging.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit f1f6fa4.

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/staging/greybus/sdio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c
index a709bd6..345cfff 100644
--- a/drivers/staging/greybus/sdio.c
+++ b/drivers/staging/greybus/sdio.c
@@ -192,8 +192,9 @@ static int gb_sdio_event_recv(u8 type, struct gb_operation *op)
 
 	request = op->request;
 
-	if (request->payload_size != sizeof(*payload)) {
-		dev_err(mmc_dev(host->mmc), "wrong event size receivedn");
+	if (request->payload_size < sizeof(*payload)) {
+		dev_err(mmc_dev(host->mmc), "wrong event size received (%zu < %zu)n",
+			request->payload_size, sizeof(*payload));
 		return -EINVAL;
 	}
 

The commit for this change in Linux stable tree is f1f6fa4 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *