All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: net: remove a dangling pointer in peak_usb_create_dev
@ 2022-01-20 13:05 Dongliang Mu
  2022-01-20 14:27 ` Pavel Skripkin
  0 siblings, 1 reply; 9+ messages in thread
From: Dongliang Mu @ 2022-01-20 13:05 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Jakub Kicinski, Stephane Grosjean, Stefan Mätje,
	Pavel Skripkin, Vincent Mailhol
  Cc: Dongliang Mu, linux-can, netdev, linux-kernel

From: Dongliang Mu <mudongliangabcd@gmail.com>

The error handling code of peak_usb_create_dev forgets to reset the
next_siblings of previous entry.

Fix this by nullifying the (dev->prev_siblings)->next_siblings in the
error handling code.

Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index b850ff8fe4bd..f858810221b6 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -894,6 +894,9 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
 		dev->adapter->dev_free(dev);
 
 lbl_unregister_candev:
+	/* remove the dangling pointer in next_siblings */
+	if (dev->prev_siblings)
+		(dev->prev_siblings)->next_siblings = NULL;
 	unregister_candev(netdev);
 
 lbl_restore_intf_data:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-24  6:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 13:05 [PATCH] drivers: net: remove a dangling pointer in peak_usb_create_dev Dongliang Mu
2022-01-20 14:27 ` Pavel Skripkin
2022-01-21  0:09   ` Dongliang Mu
2022-01-21  3:36     ` Dongliang Mu
2022-01-21  5:58       ` Dongliang Mu
2022-01-21 19:36         ` Pavel Skripkin
2022-01-22  6:45           ` Dongliang Mu
2022-01-23 13:48             ` Pavel Skripkin
2022-01-24  6:04               ` Dongliang Mu

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.