All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Unsafe MODULE_ usage in crc32.c
@ 2002-12-01  0:12 Matt Reppert
  2002-12-01  0:25 ` Petr Vandrovec
  2002-12-02 13:31 ` Arnd Bergmann
  0 siblings, 2 replies; 4+ messages in thread
From: Matt Reppert @ 2002-12-01  0:12 UTC (permalink / raw)
  To: linux-kernel

Hi,

Okay, I know, it's just a library module, doesn't need to ever be unloaded
anyway. But error noise in dmesg annoys me, hence this patch.

Matt

  Convert CRC32 to try_module_get; fixes an unsafe usage that
  prevents unloading.


 lib/crc32.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

--- linux-2.5.50/lib/crc32.c~crc32-unsafe	2002-11-30 05:31:19.000000000 -0600
+++ linux-2.5.50-arashi/lib/crc32.c	2002-11-30 05:36:17.000000000 -0600
@@ -551,7 +551,10 @@ static int __init init_crc32(void)
 	rc1 = crc32init_le();
 	rc2 = crc32init_be();
 	rc = rc1 || rc2;
-	if (!rc) MOD_INC_USE_COUNT;
+	if (!rc) {
+		if (!try_module_get(THIS_MODULE))
+			rc = -1;
+	}
 	return rc;
 }
 

[patch ends]

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

end of thread, other threads:[~2002-12-02 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-01  0:12 [PATCH] Unsafe MODULE_ usage in crc32.c Matt Reppert
2002-12-01  0:25 ` Petr Vandrovec
2002-12-02 13:31 ` Arnd Bergmann
2002-12-02 16:08   ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.