linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: insecure <insecure@mail.od.ua>
To: Jeff Garzik <jgarzik@pobox.com>,
	Linus Torvalds <torvalds@osdl.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] raceless request_region() fix (was Re: Linux 2.6.0-test4)
Date: Tue, 26 Aug 2003 00:26:47 +0300	[thread overview]
Message-ID: <200308260026.47994.insecure@mail.od.ua> (raw)
In-Reply-To: <200308260020.21817.insecure@mail.od.ua>

On Tuesday 26 August 2003 00:20, insecure wrote:
> >   o [arcnet com90io] replace check_region with temporary
> >     request_region, in probe phase.
>
> check_region() is deprecated because it is racy.
> Replacing it with request_region in probe:
>
> int probe() {
> 	if(!request_region(...))
> 		return 0;
> 	/* probe */
> 	release_region(...);
> }
>
> int init() {
> 	request_region(...);
> }
>
> only removes 'deprecated' warning. Race remains.

Corrected com90io.c patch is below.
-- 
vda

--- linux-2.6.0-test4/drivers/net/arcnet/com90io.c.orig	Sat Aug 23 02:53:52 2003
+++ linux-2.6.0-test4/drivers/net/arcnet/com90io.c	Tue Aug 26 00:22:51 2003
@@ -158,7 +158,7 @@
 		       "must specify the base address!\n");
 		return -ENODEV;
 	}
-	if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "com90io probe")) {
+	if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)")) {
 		BUGMSG(D_INIT_REASONS, "IO check_region %x-%x failed.\n",
 		       ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
 		return -ENXIO;
@@ -218,7 +218,6 @@
 			goto err_out;
 		}
 	}
-	release_region(ioaddr, ARCNET_TOTAL_SIZE); /* end of probing */
 	return com90io_found(dev);
 
 err_out:
@@ -237,13 +236,9 @@

 	/* Reserve the irq */
 	if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (COM90xx-IO)", dev)) {
+		release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
 		BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
 		return -ENODEV;
-	}
-	/* Reserve the I/O region - guaranteed to work by check_region */
-	if (!request_region(dev->base_addr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)")) {
-		free_irq(dev->irq, dev);
-		return -EBUSY;
 	}

 	/* Initialize the rest of the device structure. */


  reply	other threads:[~2003-08-25 21:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-23  0:48 Linux 2.6.0-test4 Linus Torvalds
2003-08-23  1:21 ` [PATCH] Fix cdrom error handling in 2.6 Erik Andersen
2003-08-23 12:26 ` Linux 2.6.0-test4 vlad
2003-08-23 15:31   ` Jeff Garzik
2003-08-23 15:33     ` William Scott Lockwood III
2003-08-25  5:43     ` vlad
2003-08-24 11:39 ` [PATCH] airo (was: Re: Linux 2.6.0-test4) Geert Uytterhoeven
2003-08-24 21:00   ` Javier Achirica
2003-08-24 11:47 ` [PATCH] vmlinux-*.lds " Geert Uytterhoeven
2003-08-24 11:51 ` [PATCH] macide " Geert Uytterhoeven
2003-08-24 12:20   ` Christoph Hellwig
2003-08-24 12:29     ` Geert Uytterhoeven
2003-08-25 21:00 ` [patch] 2.6.0-test4: sis190 doesn't compile with gcc 2.95 Adrian Bunk
2003-08-26 17:44   ` Jeff Garzik
2003-08-25 21:20 ` Linux 2.6.0-test4 insecure
2003-08-25 21:26   ` insecure [this message]
2003-08-25 21:59     ` [PATCH] raceless request_region() fix (was Re: Linux 2.6.0-test4) Jeff Garzik
2003-08-26  5:20       ` insecure
2003-08-25 22:56 ` Linux 2.6.0-test4 (compile statistics) John Cherry
2003-08-30  9:04 ` Linux 2.6.0-test4 Ralf Hildebrandt

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=200308260026.47994.insecure@mail.od.ua \
    --to=insecure@mail.od.ua \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --subject='[PATCH] raceless request_region() fix (was Re: Linux 2.6.0-test4)' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).