lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 30 Nov 2020 19:13:18 +0800 From: Yang Yingliang <yangyingliang@...wei.com> To: Toshiaki Makita <toshiaki.makita1@...il.com> CC: <davem@...emloft.net>, <kuba@...nel.org>, <rkovhaev@...il.com>, Netdev <netdev@...r.kernel.org> Subject: Re: [PATCH net] net: fix memory leak in register_netdevice() on error path On 2020/11/29 21:56, Toshiaki Makita wrote: > On 2020/11/26 22:23, Yang Yingliang wrote: > ... >> Reported-by: Hulk Robot <hulkci@...wei.com> >> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com> >> --- >> net/core/dev.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/net/core/dev.c b/net/core/dev.c >> index 82dc6b48e45f..907204395b64 100644 >> --- a/net/core/dev.c >> +++ b/net/core/dev.c >> @@ -10000,6 +10000,17 @@ int register_netdevice(struct net_device *dev) >> ret = notifier_to_errno(ret); >> if (ret) { >> rollback_registered(dev); >> + /* >> + * In common case, priv_destructor() will be > > As per netdev-faq, the comment style should be > > /* foobar blah blah blah > * another line of text > */ > > rather than > > /* > * foobar blah blah blah > * another line of text > */ > >> + * called in netdev_run_todo() after calling >> + * ndo_uninit() in rollback_registered(). >> + * But in this case, priv_destructor() will >> + * never be called, then it causes memory >> + * leak, so we should call priv_destructor() >> + * here. >> + */ >> + if (dev->priv_destructor) >> + dev->priv_destructor(dev); > > To be in line with netdev_run_todo(), I think priv_destructor() should be > called after "dev->reg_state = NETREG_UNREGISTERED". OK, I will send a v2 later. > > Toshiaki Makita > >> rcu_barrier(); >> dev->reg_state = NETREG_UNREGISTERED; >>
Powered by blists - more mailing lists