linux-can-fixes-for-4.5-20160226

-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABCgAGBQJW0ACIAAoJED07qiWsqSVqraYIALM+0BeB5V2g2kyjvsQS2Zah
 1139UfEwVvb3djUhEvq68+zsXwPVrBdf2Kk8KgQxOzB3ctKRp8JtN7HPLWLXrgLw
 WSFRhye/xUuPrUgiuwZ8cGR1QiBAuA/xRgFR8re7+pQ2nEzlx53neWolnjuesuWo
 5MKoyPK7LSIgkZD7VteJklpScDQDqGcbc6w6pe1yg8gwQZoDycD1+Hqj4JKehqJN
 J0W6puBL6urs9KtCzZRzMzEk09rH5BanQsAlCf4NkE0zvnPmtjptmsgRAo4rpAz3
 6L6C+B1gph04eb+dXKsIRAVdN+kCHt1Sa7PlmfxXrY2hgVLvb+pXwJ6p3O6DRXE=
 =L95V
 -----END PGP SIGNATURE-----

Merge tag 'linux-can-fixes-for-4.5-20160226' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2016-02-26

this is a pull request of one patch for net.

The patch by Maximilain Schneider fixes a kfree() problem during disconnect in
the gs_usb driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2016-03-01 15:10:38 -05:00
commit c44a72a5e8

View File

@ -826,9 +826,8 @@ static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface
static void gs_destroy_candev(struct gs_can *dev)
{
unregister_candev(dev->netdev);
free_candev(dev->netdev);
usb_kill_anchored_urbs(&dev->tx_submitted);
kfree(dev);
free_candev(dev->netdev);
}
static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
@ -913,12 +912,15 @@ static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *
for (i = 0; i < icount; i++) {
dev->canch[i] = gs_make_candev(i, intf);
if (IS_ERR_OR_NULL(dev->canch[i])) {
/* save error code to return later */
rc = PTR_ERR(dev->canch[i]);
/* on failure destroy previously created candevs */
icount = i;
for (i = 0; i < icount; i++) {
for (i = 0; i < icount; i++)
gs_destroy_candev(dev->canch[i]);
dev->canch[i] = NULL;
}
usb_kill_anchored_urbs(&dev->rx_submitted);
kfree(dev);
return rc;
}
@ -939,16 +941,12 @@ static void gs_usb_disconnect(struct usb_interface *intf)
return;
}
for (i = 0; i < GS_MAX_INTF; i++) {
struct gs_can *can = dev->canch[i];
if (!can)
continue;
gs_destroy_candev(can);
}
for (i = 0; i < GS_MAX_INTF; i++)
if (dev->canch[i])
gs_destroy_candev(dev->canch[i]);
usb_kill_anchored_urbs(&dev->rx_submitted);
kfree(dev);
}
static const struct usb_device_id gs_usb_table[] = {