diff mbox series

usb: gadget: net2280: fix NULL pointer dereference

Message ID 20230316155356.13391-1-valthebrewer@yandex.ru
State New
Headers show
Series usb: gadget: net2280: fix NULL pointer dereference | expand

Commit Message

Valery Zabrovsky March 16, 2023, 3:53 p.m. UTC
In net2280_free_request():
If _ep is NULL, then ep is NULL and is dereferenced
while trying to produce an error message.
The patch replaces dev_err() with pr_err() which works fine.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 9ceafcc2b3ad ("usb: gadget: net2280: print error in ep_ops error paths")
Signed-off-by: Valery Zabrovsky <valthebrewer@yandex.ru>
---
 drivers/usb/gadget/udc/net2280.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 1b929c519cd7..a027d1323993 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -584,8 +584,7 @@  static void net2280_free_request(struct usb_ep *_ep, struct usb_request *_req)
 
 	ep = container_of(_ep, struct net2280_ep, ep);
 	if (!_ep || !_req) {
-		dev_err(&ep->dev->pdev->dev, "%s: Invalid ep=%p or req=%p\n",
-							__func__, _ep, _req);
+		pr_err("%s: Invalid ep=%p or req=%p\n", __func__, _ep, _req);
 		return;
 	}