Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500300

[PATCH] UBI: Fix crash in try_recover_peb()

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject [PATCH] UBI: Fix crash in try_recover_peb()
Date 2016-10-13 16:30 +0200
Message-ID <srPbb-4G0-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


    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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-13 16:30 +0200
  Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-13 16:30 +0200
    Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-14 12:50 +0200
      Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 10:10 +0200
    Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 10:10 +0200
      Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-17 13:10 +0200
        Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 13:20 +0200

csiph-web