Skip to content

Commit

Permalink
can: usb_8dev: unregister netdev before free()ing
Browse files Browse the repository at this point in the history
commit 4afe215 upstream.

The usb_8dev hardware has problems on some xhci USB hosts. The driver fails to
read the firmware revision in the probe function. This leads to the following
Oops:

    [ 3356.635912] kernel BUG at net/core/dev.c:5701!

The driver tries to free the netdev, which has already been registered, without
unregistering it.

This patch fixes the problem by unregistering the netdev in the error path.

Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Reviewed-by: Bernd Krumboeck <krumboeck@universalnet.at>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Marc Kleine-Budde authored and Greg Kroah-Hartman committed Jul 3, 2013
1 parent 3dec0d5 commit bc0afb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/can/usb/usb_8dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ static int usb_8dev_probe(struct usb_interface *intf,
err = usb_8dev_cmd_version(priv, &version);
if (err) {
netdev_err(netdev, "can't get firmware version\n");
goto cleanup_cmd_msg_buffer;
goto cleanup_unregister_candev;
} else {
netdev_info(netdev,
"firmware: %d.%d, hardware: %d.%d\n",
Expand All @@ -989,6 +989,9 @@ static int usb_8dev_probe(struct usb_interface *intf,

return 0;

cleanup_unregister_candev:
unregister_netdev(priv->netdev);

cleanup_cmd_msg_buffer:
kfree(priv->cmd_msg_buffer);

Expand Down

0 comments on commit bc0afb4

Please sign in to comment.