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

greybus: hid: fix null-deref on short report requests

Make sure to verify the length of incoming requests before trying to
parse the request buffer, which can even be NULL on empty requests.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent ecf47ab9
...@@ -163,6 +163,11 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op) ...@@ -163,6 +163,11 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op)
return; return;
} }
if (op->request->payload_size < 2) {
dev_err(&connection->dev, "short report received\n");
return;
}
size = request->report[0] | request->report[1] << 8; size = request->report[0] | request->report[1] << 8;
if (!size) { if (!size) {
dev_err(&connection->dev, "bad report size: %d\n", size); dev_err(&connection->dev, "bad report size: %d\n", size);
......
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