netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: vxcan: Fix memleak in vxcan_newlink
@ 2020-10-21  5:21 Dinghao Liu
  2020-10-21 11:20 ` Oliver Hartkopp
  0 siblings, 1 reply; 6+ messages in thread
From: Dinghao Liu @ 2020-10-21  5:21 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Jakub Kicinski, linux-can, netdev, linux-kernel

When rtnl_configure_link() fails, peer needs to be
freed just like when register_netdevice() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/net/can/vxcan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
index d6ba9426be4d..aefc5a61d239 100644
--- a/drivers/net/can/vxcan.c
+++ b/drivers/net/can/vxcan.c
@@ -244,6 +244,7 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
 
 unregister_network_device:
 	unregister_netdevice(peer);
+	free_netdev(peer);
 	return err;
 }
 
-- 
2.17.1


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

end of thread, other threads:[~2020-10-22 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21  5:21 [PATCH] can: vxcan: Fix memleak in vxcan_newlink Dinghao Liu
2020-10-21 11:20 ` Oliver Hartkopp
2020-10-22  5:28   ` dinghao.liu
2020-10-22 16:14   ` Jakub Kicinski
2020-10-22 17:34     ` Oliver Hartkopp
2020-10-22 17:38       ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).