lkml.org 
[lkml]   [2016]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mtd/redboot: avoid null pointer deref
Date
By giving a bogus partition name, it's possible to trigger a null
pointer dereference.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
drivers/mtd/redboot.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 7623ac5fc586..53949ef80d36 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -212,6 +212,10 @@ static int parse_redboot_partitions(struct mtd_info *master,

nrparts++;
}
+ if (!fl) {
+ ret = -EINVAL;
+ goto out;
+ }
#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
if (fl->img->flash_base) {
nrparts++;
--
2.11.0
\
 
 \ /
  Last update: 2016-12-22 00:27    [W:0.035 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site