Skip to contentSkip to conversation

ubiupdatevol: Prevent null pointer dereference

PATCH Applied Bastian Germann 2 participants 2 messages Sep 8, 2019 – Sep 10, 2019 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubiupdatevol: Prevent null pointer dereference

libubi_close(libubi) is called in the error handler if libubi is null. Prevent that by handling the error case similar to the other ubi executables.

---
 ubi-utils/ubiupdatevol.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
ubi-utils/ubiupdatevol.c +1 -3
index bdcc091..1b3239e 100644
@@ -308,9 +308,7 @@ int main(int argc, char * const argv[])
 	if (!libubi) {
 		if (errno == 0)
 			errmsg("UBI is not present in the system");
-		else
-			sys_errmsg("cannot open libubi");
-		goto out_libubi;
+		return sys_errmsg("cannot open libubi");
 	}
 
 	err = ubi_probe_node(libubi, args.node);
Signature · 6 lines
2.23.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/