* [PATCH] USB: rndis: Fix for handling garbled messages
@ 2018-05-10 13:09 ` Phil Edworthy
0 siblings, 0 replies; 2+ messages in thread
From: Phil Edworthy @ 2018-05-10 13:09 UTC (permalink / raw)
To: Felipe Balbi
Cc: Greg Kroah-Hartman, Michal Nazarewicz, Michel Pollet,
Johannes Berg, linux-usb, linux-kernel
From: Michel Pollet <michel.pollet@bp.renesas.com>
A message can be forged to crash the stack; here we make sure we don't
completely break the system if this occurs
Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
drivers/usb/gadget/function/rndis.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 51dd3e9..04c142c 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -851,6 +851,9 @@ int rndis_msg_parser(struct rndis_params *params, u8 *buf)
*/
pr_warn("%s: unknown RNDIS message 0x%08X len %d\n",
__func__, MsgType, MsgLength);
+ /* Garbled message can be huge, so limit what we display */
+ if (MsgLength > 16)
+ MsgLength = 16;
print_hex_dump_bytes(__func__, DUMP_PREFIX_OFFSET,
buf, MsgLength);
break;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* USB: rndis: Fix for handling garbled messages
@ 2018-05-10 13:09 ` Phil Edworthy
0 siblings, 0 replies; 2+ messages in thread
From: Phil Edworthy @ 2018-05-10 13:09 UTC (permalink / raw)
To: Felipe Balbi
Cc: Greg Kroah-Hartman, Michal Nazarewicz, Michel Pollet,
Johannes Berg, linux-usb, linux-kernel
From: Michel Pollet <michel.pollet@bp.renesas.com>
A message can be forged to crash the stack; here we make sure we don't
completely break the system if this occurs
Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
drivers/usb/gadget/function/rndis.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 51dd3e9..04c142c 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -851,6 +851,9 @@ int rndis_msg_parser(struct rndis_params *params, u8 *buf)
*/
pr_warn("%s: unknown RNDIS message 0x%08X len %d\n",
__func__, MsgType, MsgLength);
+ /* Garbled message can be huge, so limit what we display */
+ if (MsgLength > 16)
+ MsgLength = 16;
print_hex_dump_bytes(__func__, DUMP_PREFIX_OFFSET,
buf, MsgLength);
break;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-10 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 13:09 [PATCH] USB: rndis: Fix for handling garbled messages Phil Edworthy
2018-05-10 13:09 ` Phil Edworthy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.