public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UBI: Fix crash in try_recover_peb()
@ 2016-10-13 14:05 Geert Uytterhoeven
  2016-10-13 14:24 ` Boris Brezillon
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-10-13 14:05 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, Brian Norris
  Cc: Artem Bityutskiy, David Woodhouse, linux-mtd, linux-kernel,
	Geert Uytterhoeven

    drivers/mtd/ubi/eba.c: In function ‘try_recover_peb’:
    drivers/mtd/ubi/eba.c:744: warning: ‘vid_hdr’ is used uninitialized in this function

The pointer vid_hdr is indeed not initialized, leading to a crash when
it is dereferenced.

Fix this by obtaining the pointer from the VID buffer, like is done
everywhere else.

Fixes: 3291b52f9ff0acc8 ("UBI: introduce the VID buffer concept")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Completely untested. And I know nothing about UBI ;-)
---
 drivers/mtd/ubi/eba.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 95c4048a371e87b6..388e46be6ad92805 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -741,6 +741,7 @@ static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
 		goto out_put;
 	}
 
+	vid_hdr = ubi_get_vid_hdr(vidb);
 	ubi_assert(vid_hdr->vol_type == UBI_VID_DYNAMIC);
 
 	mutex_lock(&ubi->buf_mutex);
-- 
1.9.1

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

end of thread, other threads:[~2016-10-17 11:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13 14:05 [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven
2016-10-13 14:24 ` Boris Brezillon
2016-10-14 10:49   ` Boris Brezillon
2016-10-17  8:00     ` Geert Uytterhoeven
2016-10-17  8:00   ` Geert Uytterhoeven
2016-10-17 11:02     ` Boris Brezillon
2016-10-17 11:10       ` Geert Uytterhoeven

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