public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()
@ 2012-11-04 20:19 Alexey Khoroshilov
  2012-11-05  8:04 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Khoroshilov @ 2012-11-04 20:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alexey Khoroshilov, MyungJoo Ham, Chanwoo Choi, patches,
	linux-kernel, ldv-project

If regmap_read() failed, arizona_micdet() returns IRQ_NONE
leaving &info->lock mutex locked as opposed to all other return paths.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/extcon/extcon-arizona.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index cdab9e5..d876a54 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -166,6 +166,7 @@ static irqreturn_t arizona_micdet(int irq, void *data)
 	ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
 	if (ret != 0) {
 		dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret);
+		mutex_unlock(&info->lock);
 		return IRQ_NONE;
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()
  2012-11-04 20:19 [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet() Alexey Khoroshilov
@ 2012-11-05  8:04 ` Mark Brown
  2012-11-05  8:37   ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2012-11-05  8:04 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: MyungJoo Ham, Chanwoo Choi, patches, linux-kernel, ldv-project

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

On Sun, Nov 04, 2012 at 01:19:46PM -0700, Alexey Khoroshilov wrote:
> If regmap_read() failed, arizona_micdet() returns IRQ_NONE
> leaving &info->lock mutex locked as opposed to all other return paths.
> 
> Found by Linux Driver Verification project (linuxtesting.org).

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()
  2012-11-05  8:04 ` Mark Brown
@ 2012-11-05  8:37   ` Chanwoo Choi
  0 siblings, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2012-11-05  8:37 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Mark Brown, MyungJoo Ham, patches, linux-kernel, ldv-project

On 11/05/2012 05:04 PM, Mark Brown wrote:
> On Sun, Nov 04, 2012 at 01:19:46PM -0700, Alexey Khoroshilov wrote:
>> If regmap_read() failed, arizona_micdet() returns IRQ_NONE
>> leaving &info->lock mutex locked as opposed to all other return paths.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied, thanks.

You can check this patch on extcon git tree:
- git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git (for-next branch)

Chanwoo Choi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-05  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-04 20:19 [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet() Alexey Khoroshilov
2012-11-05  8:04 ` Mark Brown
2012-11-05  8:37   ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox