Blame SOURCES/0033-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch

cd8c44
From 2b93288a5650bb811932836f67f30d63c5ddcfbd Mon Sep 17 00:00:00 2001
cd8c44
From: Logan Gunthorpe <logang@deltatee.com>
cd8c44
Date: Wed, 22 Jun 2022 14:25:08 -0600
2b63fb
Subject: [PATCH 33/83] DDF: Fix NULL pointer dereference in
cd8c44
 validate_geometry_ddf()
cd8c44
cd8c44
A relatively recent patch added a call to validate_geometry() in
cd8c44
Manage_add() that has level=LEVEL_CONTAINER and chunk=NULL.
cd8c44
cd8c44
This causes some ddf tests to segfault which aborts the test suite.
cd8c44
cd8c44
To fix this, avoid dereferencing chunk when the level is
cd8c44
LEVEL_CONTAINER or LEVEL_NONE.
cd8c44
cd8c44
Fixes: 1f5d54a06df0 ("Manage: Call validate_geometry when adding drive to external container")
cd8c44
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
cd8c44
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
cd8c44
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
cd8c44
---
cd8c44
 super-ddf.c | 6 +++---
cd8c44
 1 file changed, 3 insertions(+), 3 deletions(-)
cd8c44
cd8c44
diff --git a/super-ddf.c b/super-ddf.c
cd8c44
index 9d867f69..949e7d15 100644
cd8c44
--- a/super-ddf.c
cd8c44
+++ b/super-ddf.c
cd8c44
@@ -3369,9 +3369,6 @@ static int validate_geometry_ddf(struct supertype *st,
cd8c44
 	 * If given BVDs, we make an SVD, changing all the GUIDs in the process.
cd8c44
 	 */
cd8c44
 
cd8c44
-	if (*chunk == UnSet)
cd8c44
-		*chunk = DEFAULT_CHUNK;
cd8c44
-
cd8c44
 	if (level == LEVEL_NONE)
cd8c44
 		level = LEVEL_CONTAINER;
cd8c44
 	if (level == LEVEL_CONTAINER) {
cd8c44
@@ -3381,6 +3378,9 @@ static int validate_geometry_ddf(struct supertype *st,
cd8c44
 						       freesize, verbose);
cd8c44
 	}
cd8c44
 
cd8c44
+	if (*chunk == UnSet)
cd8c44
+		*chunk = DEFAULT_CHUNK;
cd8c44
+
cd8c44
 	if (!dev) {
cd8c44
 		mdu_array_info_t array = {
cd8c44
 			.level = level,
cd8c44
-- 
2b63fb
2.38.1
cd8c44