[lkml]   [2022]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2 5/9] can: mcba_usb: mcba_usb_disconnect(): fix NULL pointer dereference
mcba_usb sets the driver's priv data to NULL before waiting for the
completion of outsdanding urbs. This can results in NULL pointer
dereference, c.f. [1] and [2].

Remove the call to usb_set_intfdata(intf, NULL). The core will take
care of setting it to NULL after mcba_usb_disconnect() at [3].

[1] c/27ef17849779 ("usb: add usb_set_intfdata() documentation")

[2] thread about usb_set_intfdata() on linux-usb mailing.

[3] function usb_unbind_interface() from drivers/usb/core/driver.c

Fixes: 51f3baad7de9 ("can: mcba_usb: Add support for Microchip CAN BUS Analyzer")
Signed-off-by: Vincent Mailhol <>
drivers/net/can/usb/mcba_usb.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
index 47619e9cb005..a21c1ad4894f 100644
--- a/drivers/net/can/usb/mcba_usb.c
+++ b/drivers/net/can/usb/mcba_usb.c
@@ -890,8 +890,6 @@ static void mcba_usb_disconnect(struct usb_interface *intf)
struct mcba_priv *priv = usb_get_intfdata(intf);

- usb_set_intfdata(intf, NULL);
netdev_info(priv->netdev, "device disconnected\n");

 \ /
  Last update: 2022-12-10 10:07    [W:0.216 / U:1.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site