Skip to contentSkip to conversation

Fix netpoll cleanup on abort without dev

PATCH In review Matt Mackall 2 participants 3 messages Aug 4, 2004 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix netpoll cleanup on abort without dev

If netpoll attempts to use a device without polling support, it will oops when shutting down. This adds a check that we've actually attached to a device.

net/core/netpoll.c +2 -1
Index: np/net/core/netpoll.c
===================================================================
@@ -614,7 +614,8 @@
 		spin_lock_irqsave(&rx_list_lock, flags);
 		list_del(&np->rx_list);
 #ifdef CONFIG_NETPOLL_RX
-		np->dev->netpoll_rx = 0;
+		if (np->dev)
+			np->dev->netpoll_rx = 0;
 #endif
 		spin_unlock_irqrestore(&rx_list_lock, flags);
 	}
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#1 lore raw

==> Regarding [PATCH] Fix netpoll cleanup on abort without dev; Matt Mackall <[email protected]> adds:

mpm> If netpoll attempts to use a device without polling support, it will mpm> oops when shutting down. This adds a check that we've actually mpm> attached to a device.

Hi, Matt,

Perhaps I'm missing something, but how do we successfully return from netpoll_setup without np->dev filled in? Netpoll_setup has the following:

        if (!ndev->poll_controller) {
                printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
                       np->name, np->dev_name);
                goto release;
        }

Thanks,

Jeff

#2 lore raw
Quoted 8 lines · Jeff Moyer

==> Regarding [PATCH] Fix netpoll cleanup on abort without dev; Matt Mackall <[email protected]> adds:

mpm> If netpoll attempts to use a device without polling support, it will mpm> oops when shutting down. This adds a check that we've actually mpm> attached to a device.

Hi, Matt,

Quoted 8 lines

Perhaps I'm missing something, but how do we successfully return from netpoll_setup without np->dev filled in? Netpoll_setup has the following:

        if (!ndev->poll_controller) {
                printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
                       np->name, np->dev_name);
                goto release;
        }

We don't. What happens is netconsole is blindly calling netpoll_cleanup on module exit. I could move the np->dev check up to that point, but it seems to me that netpoll_cleanup should be made harmless instead.

ps: you still owe me a netpoll patch

Signature · 1 line
Mathematics is the supreme nostalgia of our time.