Re: Fwd: [PATCH] Unsafe MODULE_ usage in crc32.c

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Sun Dec 01 2002 - 20:56:43 EST


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:11 EST