netdev
[Top] [All Lists]

Re: modular net drivers

To: Andrew Morton <andrewm@xxxxxxxxxx>
Subject: Re: modular net drivers
From: Keith Owens <kaos@xxxxxxxxxx>
Date: Tue, 20 Jun 2000 01:20:41 +1000
Cc: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
In-reply-to: Your message of "Mon, 19 Jun 2000 23:54:30 +1000." <394E2616.C25F8376@uow.edu.au>
Sender: owner-netdev@xxxxxxxxxxx
On Mon, 19 Jun 2000 23:54:30 +1000, 
Andrew Morton <andrewm@xxxxxxxxxx> wrote:
>--- linux-2.4.0-test1-ac21/net/core/dev.c      Mon Jun 19 16:47:54 2000
>+++ linux-akpm/net/core/dev.c  Mon Jun 19 21:28:14 2000
>@@ -664,8 +665,13 @@
>        *      Call device private open method
>        */
>        
>-      if (dev->open) 
>+      if (dev->open) {
>+              if (dev->owner)
>+                      __MOD_INC_USE_COUNT(dev->owner);
>               ret = dev->open(dev);
>+              if (ret != 0 && dev->owner)
>+                      __MOD_DEC_USE_COUNT(dev->owner);
>+      }

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.


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