All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florin Malita <fmalita@gmail.com>
To: dedekind@infradead.org
Cc: linux-mtd@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] UBI: dereference after kfree in create_vtbl
Date: Thu, 03 May 2007 11:49:57 -0400	[thread overview]
Message-ID: <463A04A5.5030103@gmail.com> (raw)

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;

             reply	other threads:[~2007-05-03 15:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 15:49 Florin Malita [this message]
2007-05-04  7:17 ` [PATCH] UBI: dereference after kfree in create_vtbl Artem Bityutskiy
2007-05-04 21:42 ` Satyam Sharma
2007-05-04 21:42   ` Satyam Sharma
2007-05-04 23:22   ` Florin Malita
2007-05-04 23:22     ` Florin Malita
2007-05-05  3:55     ` Satyam Sharma
2007-05-05  3:55       ` Satyam Sharma
2007-05-05  7:55       ` Artem Bityutskiy
2007-05-05  7:55         ` Artem Bityutskiy
2007-05-05 12:26         ` Satyam Sharma
2007-05-05 12:26           ` Satyam Sharma
2007-05-05 13:18           ` Artem Bityutskiy
2007-05-05 13:18             ` Artem Bityutskiy
2007-05-05 13:48             ` Satyam Sharma
2007-05-05 13:48               ` Satyam Sharma
2007-05-05 13:59               ` Artem Bityutskiy
2007-05-05 13:59                 ` Artem Bityutskiy
2007-05-05 15:00                 ` Satyam Sharma
2007-05-05 15:00                   ` Satyam Sharma
2007-05-05 12:09       ` Artem Bityutskiy
2007-05-05 12:09         ` Artem Bityutskiy
2007-05-05 13:32         ` Satyam Sharma
2007-05-05 13:32           ` Satyam Sharma
2007-05-05 13:48           ` Artem Bityutskiy
2007-05-05 13:48             ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463A04A5.5030103@gmail.com \
    --to=fmalita@gmail.com \
    --cc=dedekind@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.