2012-11-04 20:43:13

by Alexey Khoroshilov

[permalink] [raw]
Subject: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()

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 <[email protected]>
---
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


2012-11-05 08:04:36

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()

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 <[email protected]>


Attachments:
(No filename) (330.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2012-11-05 08:37:03

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()

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 <[email protected]>

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