[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20081119.153545.42955147.davem@davemloft.net>
Date: Wed, 19 Nov 2008 15:35:45 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: jarkao2@...il.com
Cc: folkert@...heusden.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] Re: [2.6.26] OOPS in __linkwatch_run_queue (unable to
handle kernel NULL pointer dereference at 00000235)
From: David Miller <davem@...emloft.net>
Date: Mon, 17 Nov 2008 01:15:09 -0800 (PST)
> From: Jarek Poplawski <jarkao2@...il.com>
> Date: Mon, 17 Nov 2008 09:11:08 +0000
>
> > On Mon, Nov 17, 2008 at 12:50:25AM -0800, David Miller wrote:
> > Yes, this looks very nice! But this should be done in "a few" more
> > drivers, like cxgb3 etc.
>
> Thanks for pointing that out, I'll fix those cases too.
I did an audit, and found that this construct is too pervasive to
fix right now. Even e1000 and e1000e do this call of netif_carrier_off()
before the device is even registered.
So here is the bandaid I'll use to fix the bug in 2.6.28
net: Do not fire linkwatch events until the device is registered.
Several device drivers try to do things like netif_carrier_off()
before register_netdev() is invoked. This is bogus, but too many
drivers do this to fix them all up in one go.
Reported-by: Folkert van Heusden <folkert@...heusden.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
---
net/sched/sch_generic.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 93cd30c..cdcd16f 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -270,6 +270,8 @@ static void dev_watchdog_down(struct net_device *dev)
void netif_carrier_on(struct net_device *dev)
{
if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) {
+ if (dev->reg_state == NETREG_UNINITIALIZED)
+ return;
linkwatch_fire_event(dev);
if (netif_running(dev))
__netdev_watchdog_up(dev);
@@ -285,8 +287,11 @@ EXPORT_SYMBOL(netif_carrier_on);
*/
void netif_carrier_off(struct net_device *dev)
{
- if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state))
+ if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) {
+ if (dev->reg_state == NETREG_UNINITIALIZED)
+ return;
linkwatch_fire_event(dev);
+ }
}
EXPORT_SYMBOL(netif_carrier_off);
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists