extcon: arizona: unlock mutex on error path in arizona_micdet()
diff mbox series

Message ID 1352060386-13610-1-git-send-email-khoroshilov@ispras.ru
State New, archived
Headers show
Series
  • extcon: arizona: unlock mutex on error path in arizona_micdet()
Related show

Commit Message

Alexey Khoroshilov Nov. 4, 2012, 8:19 p.m. UTC
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(+)

Comments

Mark Brown Nov. 5, 2012, 8:04 a.m. UTC | #1
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>
Chanwoo Choi Nov. 5, 2012, 8:37 a.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

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