* Re: Fwd: [PATCH] Unsafe MODULE_ usage in crc32.c
[not found] <20021201002717.GB2869@ppc.vc.cvut.cz>
@ 2002-12-02 1:56 ` Rusty Russell
0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2002-12-02 1:56 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: Matt Reppert, linux-kernel
In message <20021201002717.GB2869@ppc.vc.cvut.cz> you write:
> Sorry, I forgot 'm' in your email address. BTW, I thought that this is
> fixed in 2.5.50, isn't?
> Petr
Since SMP was introduced in the kernel, MOD_INC_USE_COUNT; has never
been reliable, and since preempt was introduced, it doesn't work on UP
either[1].
It's the caller's responsibility to grab a reference. And that's OK,
because this is done automatically for you when a module is loaded
which references one of your symbols (it's the handing out of function
pointers that you have to be careful with).
In summary, the correct solution is (and always was) to delete the
MOD_INC_USE_COUNT; and MOD_DEC_USE_COUNT; in crc32.c
Looks like someone was thinking too hard 8)
Hope this helps?
Rusty.
[1] Well, theoretically it could work if you were not preemptible, but
since you can't be removed while not preemptible, there's usually no
reason to bump your own refcount anyway.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] only message in thread