greybus: operation: fix OOB Read in gb_svc_request_handler
PATCH 1/1 greybus: operation: fix OOB Read in gb_svc_request_handler
gb_connection_recv() verifies that the received buffer length is at least sizeof(header) and size >= msg_size but it does not check the msg_size (from header.size) which can be less than sizeof(header), that can cause an out-of-bound Read in gb_svc_request_handler().
Check msg_size < sizeof(header) before proceeding with header type.
Fixes 564c72b1c6f7 ("greybus: operation: fix unaligned memory accesses in receive path")
Reported-by [email protected]
Signed-off-by Chandradhar Kumar <[email protected]>
--- drivers/greybus/operation.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/greybus/operation.c +6 -0
@@ -1056,6 +1056,12 @@ void gb_connection_recv(struct gb_connection *connection,return ;/* XXX Should still complete operation */ } +if (msg_size <sizeof (header)) { +dev_err_ratelimited (dev,"%s: header size is too short\n" , + connection->name); +return ; + } +if (header.type &GB_MESSAGE_TYPE_RESPONSE ) {gb_connection_recv_response (connection, &header, data, msg_size);
Signature · 1 line
2.56.0