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

greybus: svc: fix missing version-request sanity checks

Add missing sanity checks on version-request payload size.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 87f6c976
...@@ -310,6 +310,14 @@ static int gb_svc_version_request(struct gb_operation *op) ...@@ -310,6 +310,14 @@ static int gb_svc_version_request(struct gb_operation *op)
struct gb_protocol_version_request *request; struct gb_protocol_version_request *request;
struct gb_protocol_version_response *response; struct gb_protocol_version_response *response;
if (op->request->payload_size < sizeof(*request)) {
pr_err("%d: short version request (%zu < %zu)\n",
connection->intf_cport_id,
op->request->payload_size,
sizeof(*request));
return -EINVAL;
}
request = op->request->payload; request = op->request->payload;
if (request->major > GB_SVC_VERSION_MAJOR) { if (request->major > GB_SVC_VERSION_MAJOR) {
......
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