From: david decotigny Date: Tue, 8 Jul 2014 22:14:41 +0000 (-0700) Subject: netpoll: fix use after free X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=efa95b01da18ad22af62f6d99a3243f3be8fd264;p=linux-beck.git netpoll: fix use after free After a bonding master reclaims the netpoll info struct, slaves could still hold a pointer to the reclaimed data. This patch fixes it: as soon as netpoll_async_cleanup is called for a slave (eg. when un-enslaved), we make sure that this slave doesn't point to the data. Signed-off-by: David Decotigny Signed-off-by: David S. Miller --- diff --git a/net/core/netpoll.c b/net/core/netpoll.c index e33937fb32a0..907fb5e36c02 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -822,7 +822,8 @@ void __netpoll_cleanup(struct netpoll *np) RCU_INIT_POINTER(np->dev->npinfo, NULL); call_rcu_bh(&npinfo->rcu, rcu_cleanup_netpoll_info); - } + } else + RCU_INIT_POINTER(np->dev->npinfo, NULL); } EXPORT_SYMBOL_GPL(__netpoll_cleanup);