usb: musb: Fix NULL check on struct musb_request field
authorPaul Cercueil <paul@crapouillou.net>
Sat, 23 Jan 2021 14:25:00 +0000 (14:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Feb 2021 09:27:18 +0000 (10:27 +0100)
The 'request' variable is a pointer to the 'request' field of the
struct musb_request 'req' pointer. It only worked until now because
the 'request' field is the first one in the musb_request structure, but
as soon as that changes, the check will be invalid.

Fix it preventively by doing the NULL-check on the 'req' pointer
instead.

Suggested-by: Maarten ter Huurne <maarten@treewalker.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210123142502.16980-2-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_gadget.c

index f62ffae..ef374d4 100644 (file)
@@ -451,7 +451,7 @@ void musb_g_tx(struct musb *musb, u8 epnum)
                return;
        }
 
-       if (request) {
+       if (req) {
 
                trace_musb_req_tx(req);