lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200810152027.47368.bzolnier@gmail.com>
Date:	Wed, 15 Oct 2008 20:27:47 +0200
From:	Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
To:	Elias Oltmanns <eo@...ensachen.de>
Cc:	linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Vaibhav V. Nivargi" <vaibhav.nivargi@...il.com>,
	"Alok N. Kataria" <alokk@...softinc.com>,
	Ravikiran Thirumalai <kiran@...lex86.org>,
	Shai Fultheim <shai@...lex86.org>
Subject: Re: [PATCH] ide: replace the global ide_lock spinlock by per-hwgroup spinlocks

On Sunday 12 October 2008, Elias Oltmanns wrote:
> Bartlomiej Zolnierkiewicz <bzolnier@...il.com> wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
> > Subject: [PATCH] ide: replace the global ide_lock spinlock by per-hwgroup spinlocks
> >
> > Now that (almost) all host drivers have been fixed not to abuse ide_lock
> > and core code usage of ide_lock has been sanitized we may safely replace
> > ide_lock by per-hwgroup locks.
> >
> > This patch is partially based on earlier patch from Ravikiran G Thirumalai.
> >
> > While at it:
> > - don't use deprecated HWIF() and HWGROUP() macros
> > - update locking documentation in ide.h
> >
> > Cc: Vaibhav V. Nivargi <vaibhav.nivargi@...il.com>
> > Cc: Alok N. Kataria <alokk@...softinc.com>
> > Cc: Ravikiran Thirumalai <kiran@...lex86.org>
> > Cc: Shai Fultheim <shai@...lex86.org>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
> > ---
> > this is against 2.6.27 + pata tree + pre-patchset posted on Wednesday
> > (http://lkml.org/lkml/2008/10/8/221)
> 
> I've only had a casual look at this patch, but there is one thing:
> 
> [...]
> > Index: b/drivers/ide/ide-probe.c
> > ===================================================================
> > --- a/drivers/ide/ide-probe.c
> > +++ b/drivers/ide/ide-probe.c
> [...]
> > @@ -1091,11 +1092,11 @@ static int init_irq (ide_hwif_t *hwif)
> >  		 * linked list, the first entry is the hwif that owns
> >  		 * hwgroup->handler - do not change that.
> >  		 */
> > -		spin_lock_irq(&ide_lock);
> > +		spin_lock_irq(&hwgroup->lock);
> >  		hwif->next = hwgroup->hwif->next;
> >  		hwgroup->hwif->next = hwif;
> >  		BUG_ON(hwif->next == hwif);
> > -		spin_unlock_irq(&ide_lock);
> > +		spin_unlock_irq(&hwgroup->lock);
> >  	} else {
> >  		hwgroup = kmalloc_node(sizeof(*hwgroup), GFP_KERNEL|__GFP_ZERO,
> >  				       hwif_to_node(hwif));
> 
> Something like
> 
> 	spin_lock_init(&hwgroup->lock);
> 
> should go into this else clause too.

Thanks!

I fixed this in v2, obvious interdiff:

...
v2:
Add missing spin_lock_init(&hwgroup->lock).  (Noticed by Elias Oltmanns)
...

diff -u b/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- b/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1103,6 +1103,8 @@
 		if (hwgroup == NULL)
 			goto out_up;
 
+		spin_lock_init(&hwgroup->lock);
+
 		hwif->hwgroup = hwgroup;
 		hwgroup->hwif = hwif->next = hwif;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ