Skip to contentSkip to conversation

Unsafe MODULE_ usage in crc32.c

PATCH Rusty Russell 1 participant 1 message Dec 2, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

In message <[email protected]> you write:

Quoted 3 lines

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.