2013-08-18 16:21:53

by Maarten ter Huurne

[permalink] [raw]
Subject: [PATCH] USB: musb: Avoid null pointer dereference in debug logging

Since commit 511f3c53 usb_gadget_remove_driver will pass NULL for the
driver argument.

Signed-off-by: Maarten ter Huurne <[email protected]>
---
drivers/usb/musb/musb_gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ba70923..82e5386 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1935,7 +1935,8 @@ static int musb_gadget_stop(struct usb_gadget *g,
stop_activity(musb, driver);
otg_set_peripheral(musb->xceiv->otg, NULL);

- dev_dbg(musb->controller, "unregistering driver %s\n", driver->function);
+ dev_dbg(musb->controller, "unregistering driver %s\n",
+ driver ? driver->function : "(removed)");

musb->is_active = 0;
musb->gadget_driver = NULL;
--
1.8.1.4


2013-08-18 22:06:48

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] USB: musb: Avoid null pointer dereference in debug logging

Hello.

On 18-08-2013 20:21, Maarten ter Huurne wrote:

> Since commit 511f3c53 usb_gadget_remove_driver will pass NULL for the

Please also specify that commit's summary line in parens.

> driver argument.

> Signed-off-by: Maarten ter Huurne <[email protected]>
> ---
> drivers/usb/musb/musb_gadget.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

WBR, Sergei

2013-08-19 06:24:38

by Maarten ter Huurne

[permalink] [raw]
Subject: [PATCH] USB: musb: Avoid null pointer dereference in debug logging

Since commit 511f3c53 (usb: gadget: udc-core: fix a regression during
gadget driver unbinding) usb_gadget_remove_driver will pass NULL for
the driver argument.

Signed-off-by: Maarten ter Huurne <[email protected]>
---
drivers/usb/musb/musb_gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ba70923..82e5386 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1935,7 +1935,8 @@ static int musb_gadget_stop(struct usb_gadget *g,
stop_activity(musb, driver);
otg_set_peripheral(musb->xceiv->otg, NULL);

- dev_dbg(musb->controller, "unregistering driver %s\n", driver->function);
+ dev_dbg(musb->controller, "unregistering driver %s\n",
+ driver ? driver->function : "(removed)");

musb->is_active = 0;
musb->gadget_driver = NULL;
--
1.8.1.4