From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: Matt Reppert <arashi@arashi.yi.org>
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.co.au
Subject: Re: [PATCH] Unsafe MODULE_ usage in crc32.c
Date: Sun, 1 Dec 2002 01:25:33 +0100 [thread overview]
Message-ID: <20021201002533.GA2869@ppc.vc.cvut.cz> (raw)
In-Reply-To: <20021130181224.4b4cddad.arashi@arashi.yi.org>
On Sat, Nov 30, 2002 at 06:12:24PM -0600, Matt Reppert wrote:
> 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.
Better asking Rusty, why module cannot call MOD_INC_USE_COUNT on itself
during its own init... I'm pretty sure that crc32 module knows that nobody
can unload it at this point: it is executing its own code, isn't it?
Petr Vandrovec
vandrove@vc.cvut.cz
> 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]
> -
> 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/
next prev parent reply other threads:[~2002-12-01 0:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-01 0:12 [PATCH] Unsafe MODULE_ usage in crc32.c Matt Reppert
2002-12-01 0:25 ` Petr Vandrovec [this message]
2002-12-02 13:31 ` Arnd Bergmann
2002-12-02 16:08 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021201002533.GA2869@ppc.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=arashi@arashi.yi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.co.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.