Patchwork [4/8] mtd: sst25l, fix lock imbalance

login
register
mail settings
Submitter Andrew Morton
Date Aug. 6, 2009, 11:05 p.m.
Message ID <200908062305.n76N5X6G004952@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/30905/
State New
Headers show

Comments

Andrew Morton - Aug. 6, 2009, 11:05 p.m.
From: Jiri Slaby <jirislaby@gmail.com>

Add an omitted unlock to one sst25l_erase fail path.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/devices/sst25l.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Artem Bityutskiy - Aug. 10, 2009, 7:15 a.m.
On Thu, 2009-08-06 at 16:05 -0700, akpm@linux-foundation.org wrote:
> From: Jiri Slaby <jirislaby@gmail.com>
> 
> Add an omitted unlock to one sst25l_erase fail path.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

This one is in my l2-mtd-2.6.git.

Patch

diff -puN drivers/mtd/devices/sst25l.c~mtd-sst25l-fix-lock-imbalance drivers/mtd/devices/sst25l.c
--- a/drivers/mtd/devices/sst25l.c~mtd-sst25l-fix-lock-imbalance
+++ a/drivers/mtd/devices/sst25l.c
@@ -180,8 +180,10 @@  static int sst25l_erase(struct mtd_info 
 	mutex_lock(&flash->lock);
 
 	err = sst25l_wait_till_ready(flash);
-	if (err)
+	if (err) {
+		mutex_unlock(&flash->lock);
 		return err;
+	}
 
 	while (addr < end) {
 		err = sst25l_erase_sector(flash, addr);