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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 23 Oct 2007 00:01:37 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Arnd Bergmann <arnd@...db.de>
cc:	gregkh@...e.de, <linux-arch@...r.kernel.org>,
	<linux-usb-devel@...ts.sourceforge.net>, <matthew@....cx>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...e.hu>,
	LKML <linux-kernel@...r.kernel.org>, <ralf@...ux-mips.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	<viro@...iv.linux.org.uk>, <viro@....linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	<adobriyan@...il.com>
Subject: Re: [linux-usb-devel] USB HCD: avoid duplicate local_irq_disable()

On Tue, 23 Oct 2007, Arnd Bergmann wrote:

> usb_hcd_flush_endpoint() has a retry loop that starts with a spin_lock_irq(),
> but only gives up the spinlock, not the irq_disable before jumping to the
> rescan label.
> 
> Split the spin_lock_irq into the retryable part and the local_irq_disable()
> that is only done once as a micro-optimization and slight cleanup.

I agree with your sentiment, but it would be better to solve this 
problem without using local_irq_disable().  The patch below does this.

---

Signed-off-by: Alan Stern <stern@...land.harvard.edu>

Index: usb-2.6/drivers/usb/core/hcd.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/hcd.c
+++ usb-2.6/drivers/usb/core/hcd.c
@@ -1312,8 +1312,8 @@ void usb_hcd_flush_endpoint(struct usb_d
 	hcd = bus_to_hcd(udev->bus);
 
 	/* No more submits can occur */
-rescan:
 	spin_lock_irq(&hcd_urb_list_lock);
+rescan:
 	list_for_each_entry (urb, &ep->urb_list, urb_list) {
 		int	is_in;
 
@@ -1346,6 +1346,7 @@ rescan:
 		usb_put_urb (urb);
 
 		/* list contents may have changed */
+		spin_lock(&hcd_urb_list_lock);
 		goto rescan;
 	}
 	spin_unlock_irq(&hcd_urb_list_lock);

-
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