mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Andy Chou <acc@cs.stanford.edu>
Subject: Re : 16 potential locking bugs in 2.4.1 (wavelan patch attached)
Date: Thu, 22 Mar 2001 15:23:16 -0800	[thread overview]
Message-ID: <20010322152316.A13162@bougret.hpl.hp.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

Andy Chou :
> Here are some more results from the MC project. These are 16 errors found 
> in 2.4.1 related to inconsistent use of locks. As usual, if you can 
> verify any of these or show that they are false positives, please let us 
> know by CC'ing mc@cs.stanford.edu. 
> 
> -Andy Chou 
>
> -----------------------------------------------------------------------------
> 
> [BUG] error condition 
> /u2/acc/oses/linux/2.4.1/drivers/net/pcmcia/wavelan_cs.c:2561:wavelan_get_wireless_stats:
> ERROR:LOCK:2528:2561: Inconsistent 
> lock using `spin_lock':2528 
> 
> static iw_stats * 
> wavelan_get_wireless_stats(device * dev) 
> { 
>   ... 
> --> Lock 
>   spin_lock_irqsave (&lp->lock, flags); 
> 
>   if(lp == (net_local *) NULL) 
> --> Missing unlock? 
>     return (iw_stats *) NULL; 
> 
> -----------------------------------------------------------------------------

	Thanks for the hint (actually, also thanks to LWN for
reporting this, I don't read the list).
	At first, I felt offended to have such an obvious bug in my
driver, and then I check the master copy of the driver in the Pcmcia
package that I maintain, and it doesn't contain this bug. So whoever
did the port from Pcmcia -> kernel introduced this one :-(
	Patch attached. Have fun...

	Jean


[-- Attachment #2: wav_cs.spinret.diff --]
[-- Type: text/plain, Size: 688 bytes --]

diff -u -p linux/drivers/net/pcmcia/wireless.24d/wavelan_cs.c linux/drivers/net/pcmcia/wavelan_cs.c
--- linux/drivers/net/pcmcia/wireless.24d/wavelan_cs.c	Thu Mar 22 15:08:46 2001
+++ linux/drivers/net/pcmcia/wavelan_cs.c	Thu Mar 22 15:10:25 2001
@@ -2524,11 +2524,13 @@ wavelan_get_wireless_stats(device *	dev)
   printk(KERN_DEBUG "%s: ->wavelan_get_wireless_stats()\n", dev->name);
 #endif
 
+  /* Pure paranoia */
+  if(lp == (net_local *) NULL)
+    return (iw_stats *) NULL;
+
   /* Disable interrupts & save flags */
   spin_lock_irqsave (&lp->lock, flags);
 
-  if(lp == (net_local *) NULL)
-    return (iw_stats *) NULL;
   wstats = &lp->wstats;
 
   /* Get data from the mmc */

                 reply	other threads:[~2001-03-22 23:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010322152316.A13162@bougret.hpl.hp.com \
    --to=jt@bougret.hpl.hp.com \
    --cc=acc@cs.stanford.edu \
    --cc=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®