netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
@ 2003-05-21 20:48 Daniel McNeil
  2003-05-21 23:18 ` Arnaldo Carvalho de Melo
  2003-05-21 23:22 ` David S. Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel McNeil @ 2003-05-21 20:48 UTC (permalink / raw)
  To: ncorbic, dm, davem@redhat.com; +Cc: netdev@oss.sgi.com

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

Here is simple patch to remove MOD_INC_USE_COUNT and
MOD_DEC_USE_COUNT.  The wanrouter module will get a reference
when another module uses its exported symbols.

-- 
Daniel McNeil <daniel@osdl.org>

[-- Attachment #2: patch-2.5.69-wan --]
[-- Type: text/x-patch, Size: 614 bytes --]

diff -rupN -X /home/daniel/dontdiff linux-2.5.69/net/wanrouter/wanmain.c linux-2.5.69.wan/net/wanrouter/wanmain.c
--- linux-2.5.69/net/wanrouter/wanmain.c	Sun May  4 16:53:35 2003
+++ linux-2.5.69.wan/net/wanrouter/wanmain.c	Wed May 21 11:37:50 2003
@@ -303,7 +303,6 @@ int register_wan_device(wan_device_t *wa
 	wandev->next = router_devlist;
 	router_devlist = wandev;
 	++devcnt;
-        MOD_INC_USE_COUNT;	/* prevent module from unloading */
 	return 0;
 }
 
@@ -348,7 +347,6 @@ int unregister_wan_device(char *name)
 
 	--devcnt;
 	wanrouter_proc_delete(wandev);
-        MOD_DEC_USE_COUNT;
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 20:48 [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Daniel McNeil
@ 2003-05-21 23:18 ` Arnaldo Carvalho de Melo
  2003-05-21 23:27   ` David S. Miller
  2003-05-21 23:22 ` David S. Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2003-05-21 23:18 UTC (permalink / raw)
  To: Daniel McNeil; +Cc: ncorbic, dm, davem@redhat.com, netdev@oss.sgi.com

Em Wed, May 21, 2003 at 01:48:32PM -0700, Daniel McNeil escreveu:
> Here is simple patch to remove MOD_INC_USE_COUNT and
> MOD_DEC_USE_COUNT.  The wanrouter module will get a reference
> when another module uses its exported symbols.

I have patches that will conflict with this one, fixing the
namespace, i.e. device_shutdown now its a core function that ends
up having its prototype included in wanmain compilation, causing
compilation to fail.

Already submitted to DaveM, CCed netdev, I'll fix this later
tonight.

- Arnaldo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 20:48 [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Daniel McNeil
  2003-05-21 23:18 ` Arnaldo Carvalho de Melo
@ 2003-05-21 23:22 ` David S. Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David S. Miller @ 2003-05-21 23:22 UTC (permalink / raw)
  To: daniel; +Cc: ncorbic, dm, netdev

   From: Daniel McNeil <daniel@osdl.org>
   Date: 21 May 2003 13:48:32 -0700

   Here is simple patch to remove MOD_INC_USE_COUNT and
   MOD_DEC_USE_COUNT.  The wanrouter module will get a reference
   when another module uses its exported symbols.
   
What if that other module doesn't get loaded?
The things registered in procfs need to have their
->owner field set.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 23:18 ` Arnaldo Carvalho de Melo
@ 2003-05-21 23:27   ` David S. Miller
  2003-05-22  0:40     ` Arnaldo Carvalho de Melo
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David S. Miller @ 2003-05-21 23:27 UTC (permalink / raw)
  To: acme; +Cc: daniel, ncorbic, dm, netdev

   From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
   Date: Wed, 21 May 2003 20:18:01 -0300
   
   Already submitted to DaveM, CCed netdev, I'll fix this later
   tonight.

Note that, as I said in another email, these MOD_* calls can't just be
deleted, the PROCFS registry etc. have to set ->owner fields correctly
before this is valid.

By just removing MOD_*(), I can load just wanrouter, open a proc file,
unload the wanrouter module, and crash.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 23:27   ` David S. Miller
@ 2003-05-22  0:40     ` Arnaldo Carvalho de Melo
  2003-05-22  0:47     ` Arnaldo Carvalho de Melo
  2003-05-22 16:14     ` Daniel McNeil
  2 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2003-05-22  0:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: daniel, ncorbic, dm, netdev

Em Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu:
>    From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
>    Date: Wed, 21 May 2003 20:18:01 -0300
>    
>    Already submitted to DaveM, CCed netdev, I'll fix this later
>    tonight.
> 
> Note that, as I said in another email, these MOD_* calls can't just be
> deleted, the PROCFS registry etc. have to set ->owner fields correctly
> before this is valid.

Agreed.
 
> By just removing MOD_*(), I can load just wanrouter, open a proc file,
> unload the wanrouter module, and crash.

yup.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 23:27   ` David S. Miller
  2003-05-22  0:40     ` Arnaldo Carvalho de Melo
@ 2003-05-22  0:47     ` Arnaldo Carvalho de Melo
  2003-05-22  7:59       ` David S. Miller
  2003-05-22 16:14     ` Daniel McNeil
  2 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2003-05-22  0:47 UTC (permalink / raw)
  To: David S. Miller; +Cc: daniel, ncorbic, dm, netdev

Em Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu:
>    From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
>    Date: Wed, 21 May 2003 20:18:01 -0300
>    
>    Already submitted to DaveM, CCed netdev, I'll fix this later
>    tonight.
> 
> Note that, as I said in another email, these MOD_* calls can't just be
> deleted, the PROCFS registry etc. have to set ->owner fields correctly
> before this is valid.

Yoshfuji-san has already done this in wanproc.c.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-22  0:47     ` Arnaldo Carvalho de Melo
@ 2003-05-22  7:59       ` David S. Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David S. Miller @ 2003-05-22  7:59 UTC (permalink / raw)
  To: acme; +Cc: daniel, ncorbic, dm, netdev

   From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
   Date: Wed, 21 May 2003 21:47:18 -0300

   Em Wed, May 21, 2003 at 04:27:07PM -0700, David S. Miller escreveu:
   > Note that, as I said in another email, these MOD_* calls can't just be
   > deleted, the PROCFS registry etc. have to set ->owner fields correctly
   > before this is valid.
   
   Yoshfuji-san has already done this in wanproc.c.
   
That's true.  But we need to check for other cases to make
sure they are ok.  For example, wanrouter_router_devlist.

If you really think it's fine, just resend the change and I'll
install it.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT
  2003-05-21 23:27   ` David S. Miller
  2003-05-22  0:40     ` Arnaldo Carvalho de Melo
  2003-05-22  0:47     ` Arnaldo Carvalho de Melo
@ 2003-05-22 16:14     ` Daniel McNeil
  2 siblings, 0 replies; 8+ messages in thread
From: Daniel McNeil @ 2003-05-22 16:14 UTC (permalink / raw)
  To: David S. Miller; +Cc: acme, ncorbic, dm, netdev

On Wed, 2003-05-21 at 16:27, David S. Miller wrote:
>    From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
>    Date: Wed, 21 May 2003 20:18:01 -0300
>    
>    Already submitted to DaveM, CCed netdev, I'll fix this later
>    tonight.
> 
> Note that, as I said in another email, these MOD_* calls can't just be
> deleted, the PROCFS registry etc. have to set ->owner fields correctly
> before this is valid.
> 
> By just removing MOD_*(), I can load just wanrouter, open a proc file,
> unload the wanrouter module, and crash.

The proc file looked like a separate problem.  The MOD_* calls I removed
were in register_wan_device/unregister_wan_device, so these did not
protect the procfs entries for wanrouter.  If another module called
register_wan_device, the wanrouter module couldn't be unloaded because
of the symbol reference.  Of course, the modules that call
register_wan_device also need to kept from being unloaded until
have unregister_wan_device.  Again, I thought these were separate
problems.

Arnaldo, sorry about the conflicting patch.  We in the middle of moving
and I hadn't had a chance to catch up on the mailing list.

-- 
Daniel McNeil <daniel@osdl.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-22 16:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-21 20:48 [PATCH 2.5.69] wanrouter clean up MOD_*_USE_COUNT Daniel McNeil
2003-05-21 23:18 ` Arnaldo Carvalho de Melo
2003-05-21 23:27   ` David S. Miller
2003-05-22  0:40     ` Arnaldo Carvalho de Melo
2003-05-22  0:47     ` Arnaldo Carvalho de Melo
2003-05-22  7:59       ` David S. Miller
2003-05-22 16:14     ` Daniel McNeil
2003-05-21 23:22 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).