diff options
author | Satyam Sharma <ssatyam@cse.iitk.ac.in> | 2007-07-09 18:22:23 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:19:02 -0400 |
commit | 1498b3f1952ae539a7d5c356acf942d5f4c1aece (patch) | |
tree | 70307da369971a106f817c47b0b9cf9d8e3d574f /net/core | |
parent | 5f1de3ec661e7b08348f565b7ca17586e7e94fc5 (diff) |
[NETPOLL]: Fix a leak-n-bug in netpoll_cleanup()
93ec2c723e3f8a216dde2899aeb85c648672bc6b applied excessive duct tape to
the netpoll beast's netpoll_cleanup(), thus substituting one leak with
another, and opening up a little buglet :-)
net_device->npinfo (netpoll_info) is a shared and refcounted object and
cannot simply be set NULL the first time netpoll_cleanup() is called.
Otherwise, further netpoll_cleanup()'s see np->dev->npinfo == NULL and
become no-ops, thus leaking. And it's a bug too: the first call to
netpoll_cleanup() would thus (annoyingly) "disable" other (still alive)
netpolls too. Maybe nobody noticed this because netconsole (only user
of netpoll) never supported multiple netpoll objects earlier.
This is a trivial and obvious one-line fixlet.
Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/netpoll.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 4b06d1936375..de1b26aa5720 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -783,7 +783,6 @@ void netpoll_cleanup(struct netpoll *np) | |||
783 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | 783 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); |
784 | } | 784 | } |
785 | 785 | ||
786 | np->dev->npinfo = NULL; | ||
787 | if (atomic_dec_and_test(&npinfo->refcnt)) { | 786 | if (atomic_dec_and_test(&npinfo->refcnt)) { |
788 | skb_queue_purge(&npinfo->arp_tx); | 787 | skb_queue_purge(&npinfo->arp_tx); |
789 | skb_queue_purge(&npinfo->txq); | 788 | skb_queue_purge(&npinfo->txq); |
@@ -796,6 +795,7 @@ void netpoll_cleanup(struct netpoll *np) | |||
796 | kfree_skb(skb); | 795 | kfree_skb(skb); |
797 | } | 796 | } |
798 | kfree(npinfo); | 797 | kfree(npinfo); |
798 | np->dev->npinfo = NULL; | ||
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||