* pull-request: can 2016-02-26
@ 2016-02-26 7:42 Marc Kleine-Budde
2016-02-26 7:42 ` [PATCH] can: gs_usb: fixed disconnect bug by removing erroneous use of kfree() Marc Kleine-Budde
2016-03-01 20:17 ` pull-request: can 2016-02-26 David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2016-02-26 7:42 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
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.
regrds,
Marc
---
The following changes since commit 4c0b6eaf373a5323f03a3a20c42fc435715b073d:
net: thunderx: Fix for Qset error due to CQ full (2016-02-25 16:25:34 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.5-20160226
for you to fetch changes up to e9a2d81b1761093386a0bb8a4f51642ac785ef63:
can: gs_usb: fixed disconnect bug by removing erroneous use of kfree() (2016-02-26 08:36:33 +0100)
----------------------------------------------------------------
linux-can-fixes-for-4.5-20160226
----------------------------------------------------------------
Maximilain Schneider (1):
can: gs_usb: fixed disconnect bug by removing erroneous use of kfree()
drivers/net/can/usb/gs_usb.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] can: gs_usb: fixed disconnect bug by removing erroneous use of kfree()
2016-02-26 7:42 pull-request: can 2016-02-26 Marc Kleine-Budde
@ 2016-02-26 7:42 ` Marc Kleine-Budde
2016-03-01 20:17 ` pull-request: can 2016-02-26 David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2016-02-26 7:42 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Maximilain Schneider, linux-stable,
Marc Kleine-Budde
From: Maximilain Schneider <max@schneidersoft.net>
gs_destroy_candev() erroneously calls kfree() on a struct gs_can *, which is
allocated through alloc_candev() and should instead be freed using
free_candev() alone.
The inappropriate use of kfree() causes the kernel to hang when
gs_destroy_candev() is called.
Only the struct gs_usb * which is allocated through kzalloc() should be freed
using kfree() when the device is disconnected.
Signed-off-by: Maximilian Schneider <max@schneidersoft.net>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/gs_usb.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 5eee62badf45..cbc99d5649af 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -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[] = {
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: pull-request: can 2016-02-26
2016-02-26 7:42 pull-request: can 2016-02-26 Marc Kleine-Budde
2016-02-26 7:42 ` [PATCH] can: gs_usb: fixed disconnect bug by removing erroneous use of kfree() Marc Kleine-Budde
@ 2016-03-01 20:17 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-01 20:17 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can, kernel
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 26 Feb 2016 08:42:57 +0100
> 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.
Pulled, thanks Marc.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-01 20:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 7:42 pull-request: can 2016-02-26 Marc Kleine-Budde
2016-02-26 7:42 ` [PATCH] can: gs_usb: fixed disconnect bug by removing erroneous use of kfree() Marc Kleine-Budde
2016-03-01 20:17 ` pull-request: can 2016-02-26 David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.