[Top] [All Lists]

Re: modular net drivers

To: Keith Owens <kaos@xxxxxxxxxx>
Subject: Re: modular net drivers
From: Andrew Morton <andrewm@xxxxxxxxxx>
Date: Tue, 20 Jun 2000 02:06:47 +1000
Cc: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
References: Your message of "Mon, 19 Jun 2000 23:54:30 +1000." <> <4516.961428041@ocs3.ocs-net>
Sender: owner-netdev@xxxxxxxxxxx
Keith Owens wrote:
> Racy.  The module referred to by dev->owner might be in the middle of
> being unloaded.  You need try_inc_mod_count() with a check on its
> result instead of __MOD_INC_USE_COUNT.

eww.  That would mean the existing code is racy.  I assumed it took care
of this elsewhere. Maybe not.  try_inc_mod_count looks good.

Petr Vandrovec wrote:
> You should change it to
>     if (dev->owner)
>         __MOD_INC_USE_COUNT(dev->owner);
>     if (dev->open)
>         ret = dev->open(dev);
>     if (ret != 0 && dev->owner)
>         __MOD_DEC_USE_COUNT(dev->owner);
>     ...

<slaps head>

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