linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: mtu3: Fix possible use-before-initialization bug
@ 2023-07-04 23:25 Yu Hao
  2023-07-05  6:06 ` Herve Codina
  2023-07-05  7:16 ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Yu Hao @ 2023-07-04 23:25 UTC (permalink / raw)
  To: chunfeng.yun, gregkh, linux-usb, linux-arm-kernel, linux-mediatek,
	linux-kernel

The struct usb_ctrlrequest setup should be initialized in the function
ep0_read_setup(mtu, &setup). However, inside that function,
the variable count could be 0 and the struct usb_ctrlrequest setup
is not initialized. But there is a read for setup.bRequestType.

Signed-off-by: Yu Hao <yhao016@ucr.edu>
---
 drivers/usb/mtu3/mtu3_gadget_ep0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget_ep0.c
b/drivers/usb/mtu3/mtu3_gadget_ep0.c
index e4fd1bb14a55..67034fa515d0 100644
--- a/drivers/usb/mtu3/mtu3_gadget_ep0.c
+++ b/drivers/usb/mtu3/mtu3_gadget_ep0.c
@@ -638,7 +638,7 @@ static int ep0_handle_setup(struct mtu3 *mtu)
 __releases(mtu->lock)
 __acquires(mtu->lock)
 {
-   struct usb_ctrlrequest setup;
+   struct usb_ctrlrequest setup = {};
    struct mtu3_request *mreq;
    int handled = 0;

-- 
2.34.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-11  9:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04 23:25 [PATCH] usb: mtu3: Fix possible use-before-initialization bug Yu Hao
2023-07-05  6:06 ` Herve Codina
2023-07-10  0:48   ` Yu Hao
2023-07-10  6:25     ` Herve Codina
2023-07-11  8:48       ` Chunfeng Yun (云春峰)
2023-07-11  9:41         ` Herve Codina
2023-07-11  8:40     ` Chunfeng Yun (云春峰)
2023-07-05  7:16 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).