From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org, tglx@linutronix.de,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 2/3] mtd: ubi: don't leak e if schedule_erase() fails
Date: Thu, 26 Nov 2015 21:23:49 +0100 [thread overview]
Message-ID: <1448569430-885-2-git-send-email-bigeasy@linutronix.de> (raw)
In-Reply-To: <1448569430-885-1-git-send-email-bigeasy@linutronix.de>
If __erase_worker() fails to erase the EB and schedule_erase() fails as
well to do anything about it then we go RO. But that is not a reason to
leak the e argument here. Therefore clean up e.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/mtd/ubi/wl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index f73233fa737c..56065632a5b8 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1060,6 +1060,7 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
/* Re-schedule the LEB for erasure */
err1 = schedule_erase(ubi, e, vol_id, lnum, 0);
if (err1) {
+ wl_entry_destroy(ubi, e);
err = err1;
goto out_ro;
}
--
2.6.2
next prev parent reply other threads:[~2015-11-26 20:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 20:23 [PATCH 1/3] mtd: ubi: fixup error correction in do_sync_erase() Sebastian Andrzej Siewior
2015-11-26 20:23 ` Sebastian Andrzej Siewior [this message]
2015-11-26 20:23 ` [PATCH 3/3] mtd: ubi: wl: avoid erasing a PEB which is empty Sebastian Andrzej Siewior
2015-12-01 19:46 ` Richard Weinberger
2015-12-02 11:56 ` 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=1448569430-885-2-git-send-email-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=tglx@linutronix.de \
/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 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).