mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: <Heinrich.Toews@wago.com>
To: barebox@lists.infradead.org
Subject: [PATCH v2] nand-bb: mtd_del_bb: fix missing pointer reset
Date: Mon, 18 Jun 2018 10:48:18 +0000	[thread overview]
Message-ID: <1529318902-12692-1-git-send-email-heinrich.toews@wago.com> (raw)
In-Reply-To: <1529315540-10480-1-git-send-email-heinrich.toews@wago.com>

If an attached bb device was removed before the actual mtd device
the code would try due to a missing pointer reset to access
the no more present bb device handle which leads to a page fault.

This bug was made visible by commit "7649473 mtd: nand: remove
automatically created bb devices" which relys on a correct
mtd->cdev_bb handling.

Signed-off-by: Heinrich Toews <heinrich.toews@wago.com>
---
Change since v1: add Signed-off-by
---
 drivers/mtd/nand/nand-bb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index c197738..012163e 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -316,6 +316,8 @@ void mtd_del_bb(struct mtd_info *mtd)
 	list_del_init(&bb->list);
 	free(bb->name);
 	free(bb);
+
+	mtd->cdev_bb = NULL;
 }
 
 /**
-- 
2.7.4

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-06-18 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  9:52 [PATCH] " Heinrich.Toews
2018-06-18 10:48 ` Heinrich.Toews [this message]
2018-06-18 20:54   ` [PATCH v2] " Sascha Hauer

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=1529318902-12692-1-git-send-email-heinrich.toews@wago.com \
    --to=heinrich.toews@wago.com \
    --cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox