Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1388892
| From | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] veth: Fix potential memory leak in veth_newlink |
| Date | 2016-04-27 13:00 +0200 |
| Message-ID | <rsvmi-8dS-9@gated-at.bofh.it> (permalink) |
| References | <rsvcC-8ae-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 04/27/2016 12:42 PM, Haishuang Yan wrote: > Free peer netdev when failed to configure peer link or register dev. > > Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com> > --- > drivers/net/veth.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/net/veth.c b/drivers/net/veth.c > index f37a6e6..8bb9fb8 100644 > --- a/drivers/net/veth.c > +++ b/drivers/net/veth.c > @@ -472,7 +472,6 @@ err_register_dev: > /* nothing to do */ > err_configure_peer: > unregister_netdevice(peer); > - return err; > > err_register_peer: > free_netdev(peer); > No, it won't leak. unregister_netdevice() will queue it on the todo list and at the next rtnl unlock the peer device will get freed. In fact calling it like this you'll hit BUG_ON(dev->reg_state != NETREG_UNREGISTERED) in free_netdev so I guess you didn't even test your patch.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] veth: Fix potential memory leak in veth_newlink Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2016-04-27 12:50 +0200 Re: [PATCH] veth: Fix potential memory leak in veth_newlink Nikolay Aleksandrov <nikolay@cumulusnetworks.com> - 2016-04-27 13:00 +0200
csiph-web