[lkml]   [2007]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ review 14/84] Netpoll leak
    From: Satyam Sharma <>

    [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 <>
    Signed-off-by: David S. Miller <>
    Signed-off-by: Greg Kroah-Hartman <>

    net/core/netpoll.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/net/core/netpoll.c
    +++ b/net/core/netpoll.c
    @@ -781,7 +781,6 @@ void netpoll_cleanup(struct netpoll *np)
    spin_unlock_irqrestore(&npinfo->rx_lock, flags);

    - np->dev->npinfo = NULL;
    if (atomic_dec_and_test(&npinfo->refcnt)) {
    @@ -794,6 +793,7 @@ void netpoll_cleanup(struct netpoll *np)
    + np->dev->npinfo = NULL;

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-08-07 22:55    [W:0.021 / U:1.068 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site