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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1342856418-1451-1-git-send-email-yefremov.denis@gmail.com>
Date:	Sat, 21 Jul 2012 11:40:18 +0400
From:	Denis Efremov <yefremov.denis@...il.com>
To:	Felipe Balbi <balbi@...com>
Cc:	Denis Efremov <yefremov.denis@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] usb: otg: twl4030-usb: spin_unlock_irq in interrupt handler

The replacement of spin_lock_irq/spin_unlock_irq pair in
twl4030_usb_linkstat function by
spin_lock_irqsave/spin_lock_irqrestore pair.
The twl4030_usb_linkstat function is called from twl4030_usb_irq
interrupt handler. Therefore reenabling of handler interrupt line
should be avoided.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <yefremov.denis@...il.com>
---
 drivers/usb/otg/twl4030-usb.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index c4a86da..c89a2f5 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -251,6 +251,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	int	status;
 	int	linkstat = USB_EVENT_NONE;
 	struct usb_otg *otg = twl->phy.otg;
+	unsigned long flags;
 
 	twl->vbus_supplied = false;
 
@@ -288,7 +289,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	 * are registered, and that both are active...
 	 */
 
-	spin_lock_irq(&twl->lock);
+	spin_lock_irqsave(&twl->lock, flags);
 	twl->linkstat = linkstat;
 	if (linkstat == USB_EVENT_ID) {
 		otg->default_a = true;
@@ -297,7 +298,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 		otg->default_a = false;
 		twl->phy.state = OTG_STATE_B_IDLE;
 	}
-	spin_unlock_irq(&twl->lock);
+	spin_unlock_irqrestore(&twl->lock, flags);
 
 	return linkstat;
 }
-- 
1.7.7

--
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