linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [patch] UBI: release locks in check_corruption()
@ 2010-11-18  3:58 Dan Carpenter
  2010-11-19 13:20 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-11-18  3:58 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, kernel-janitors, David Woodhouse

Commit 45aafd32996e27 "UBI: tighten the corrupted PEB criteria"
introduced some return paths that didn't release the ubi->buf_mutex;

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 3c63186..204345b 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -787,16 +787,15 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
 		 * erased, so it became unstable and corrupted, and should be
 		 * erased.
 		 */
-		return 0;
+		err = 0;
+		goto out_unlock;
 	}
 
 	if (err)
-		return err;
+		goto out_unlock;
 
-	if (ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->leb_size)) {
-		mutex_unlock(&ubi->buf_mutex);
-		return 0;
-	}
+	if (ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->leb_size))
+		goto out_unlock;
 
 	ubi_err("PEB %d contains corrupted VID header, and the data does not "
 		"contain all 0xFF, this may be a non-UBI PEB or a severe VID "
@@ -806,8 +805,11 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
 		pnum, ubi->leb_start, ubi->leb_size);
 	ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1,
 			       ubi->peb_buf1, ubi->leb_size, 1);
+	err = 1;
+
+out_unlock:
 	mutex_unlock(&ubi->buf_mutex);
-	return 1;
+	return err;
 }
 
 /**

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

* Re: [patch] UBI: release locks in check_corruption()
  2010-11-18  3:58 [patch] UBI: release locks in check_corruption() Dan Carpenter
@ 2010-11-19 13:20 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-11-19 13:20 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mtd, kernel-janitors, David Woodhouse

On Thu, 2010-11-18 at 06:58 +0300, Dan Carpenter wrote:
> Commit 45aafd32996e27 "UBI: tighten the corrupted PEB criteria"
> introduced some return paths that didn't release the ubi->buf_mutex;
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c

Thank you, pushed to ubi-2.6.git tree.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2010-11-19 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18  3:58 [patch] UBI: release locks in check_corruption() Dan Carpenter
2010-11-19 13:20 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).