netdev
[Top] [All Lists]

Re: [PATCH 7/7] netpoll: avoid kfree_skb on packets with destructo

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: Re: [PATCH 7/7] netpoll: avoid kfree_skb on packets with destructo
From: Matt Mackall <mpm@xxxxxxxxxxx>
Date: Thu, 3 Mar 2005 13:32:28 -0800
Cc: jgarzik@xxxxxxxxx, netdev@xxxxxxxxxxx, jmoyer@xxxxxxxxxx
In-reply-to: <20050303130031.066f0862.davem@xxxxxxxxxxxxx>
References: <7.454130102@xxxxxxxxxxx> <8.454130102@xxxxxxxxxxx> <20050303130031.066f0862.davem@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Thu, Mar 03, 2005 at 01:00:31PM -0800, David S. Miller wrote:
> On Thu, 03 Mar 2005 14:46:32 -0600
> Matt Mackall <mpm@xxxxxxxxxxx> wrote:
> 
> > Packets that have destructors should not be zapped here as that might
> > produce additional printk warnings via netconsole.
> > 
> > Signed-off-by: Matt Mackall <mpm@xxxxxxxxxxx>
> 
> Then where will they be freed, eh? :-)
> 
> This patch adds an SKB leak.  Since you've NULL'd out the list, any
> SKB skipped will never be freed up at all.

Doh. Plain as day. How's this look?

Packets that have destructors should not be zapped here as that might
produce additional printk warnings via netconsole.

Signed-off-by: Matt Mackall <mpm@xxxxxxxxxxx>

Index: np/net/core/netpoll.c
===================================================================
--- np.orig/net/core/netpoll.c  2005-03-03 14:16:29.579809668 -0600
+++ np/net/core/netpoll.c       2005-03-03 15:26:38.826754614 -0600
@@ -192,7 +192,10 @@ static void zap_completion_queue(void)
                while (clist != NULL) {
                        struct sk_buff *skb = clist;
                        clist = clist->next;
-                       __kfree_skb(skb);
+                       if(skb->destructor)
+                               dev_kfree_skb_any(skb); /* put this one back */
+                       else
+                               __kfree_skb(skb);
                }
        }
 


-- 
Mathematics is the supreme nostalgia of our time.

<Prev in Thread] Current Thread [Next in Thread>