public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] UBI: dereference after kfree in create_vtbl
@ 2007-05-03 15:49 Florin Malita
  2007-05-04  7:17 ` Artem Bityutskiy
  2007-05-04 21:42 ` Satyam Sharma
  0 siblings, 2 replies; 14+ messages in thread
From: Florin Malita @ 2007-05-03 15:49 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd, Linux Kernel Mailing List

Coverity (CID 1614) spotted new_seb being dereferenced after kfree() in 
create_vtbl's write_error path.


Signed-off-by: Florin Malita <fmalita@gmail.com>
---

 vtbl.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index b6fd6bb..91e3619 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -317,14 +317,13 @@ retry:
 	return err;
 
 write_error:
-	kfree(new_seb);
-	/* May be this physical eraseblock went bad, try to pick another one */
-	if (++tries <= 5) {
+	/* Maybe this physical eraseblock went bad, try to pick another one */
+	if (++tries <= 5)
 		err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec,
 					   &si->corr);
-		if (!err)
-			goto retry;
-	}
+	kfree(new_seb);	
+	if (!err)
+		goto retry;
 out_free:
 	ubi_free_vid_hdr(ubi, vid_hdr);
 	return err;

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

end of thread, other threads:[~2007-05-05 15:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-03 15:49 [PATCH] UBI: dereference after kfree in create_vtbl Florin Malita
2007-05-04  7:17 ` Artem Bityutskiy
2007-05-04 21:42 ` Satyam Sharma
2007-05-04 23:22   ` Florin Malita
2007-05-05  3:55     ` Satyam Sharma
2007-05-05  7:55       ` Artem Bityutskiy
2007-05-05 12:26         ` Satyam Sharma
2007-05-05 13:18           ` Artem Bityutskiy
2007-05-05 13:48             ` Satyam Sharma
2007-05-05 13:59               ` Artem Bityutskiy
2007-05-05 15:00                 ` Satyam Sharma
2007-05-05 12:09       ` Artem Bityutskiy
2007-05-05 13:32         ` Satyam Sharma
2007-05-05 13:48           ` Artem Bityutskiy

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