Skip to contentSkip to conversation

multipathd/cli_handlers cli_resize : check pp and pgp before calling them to avoid multipathd core dump.

PATCH Applied [email protected] 2 participants 2 messages Jun 17, 2013 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipathd/cli_handlers cli_resize : check pp and pgp before calling them to avoid multipathd core dump.

From: Eli Qiao <[email protected]>

---
 multipathd/cli_handlers.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
multipathd/cli_handlers.c +11 -0
index 7b1cb62..4b860bb 100644
@@ -603,7 +603,18 @@ cli_resize(void *v, char **reply, int *len, void *data)
 	}
 
 	pgp = VECTOR_SLOT(mpp->pg, 0);
+
+	if (!pgp){
+		condlog(0, "%s: couldn't get path group. cannot resize",
+			mapname);
+		return 1;
+	}
 	pp = VECTOR_SLOT(pgp->paths, 0);
+
+	if (!pp){
+		condlog(0, "%s: couldn't get path. cannot resize", mapname);
+		return 1;
+	}
 	if (!pp->udev || sysfs_get_size(pp, &size)) {
 		condlog(0, "%s: couldn't get size for sysfs. cannot resize",
 			mapname);
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 2 lines · On lun., 2013-06-17 at 11:53 +0800, [email protected] wrote:

From: Eli Qiao <[email protected]>

Applied.
Thanks,

Christophe Varoqui
www.opensvc.com

Quoted 28 lines
---
 multipathd/cli_handlers.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
multipathd/cli_handlers.c +11 -0
index 7b1cb62..4b860bb 100644
@@ -603,7 +603,18 @@ cli_resize(void *v, char **reply, int *len, void *data)
 	}
 
 	pgp = VECTOR_SLOT(mpp->pg, 0);
+
+	if (!pgp){
+		condlog(0, "%s: couldn't get path group. cannot resize",
+			mapname);
+		return 1;
+	}
 	pp = VECTOR_SLOT(pgp->paths, 0);
+
+	if (!pp){
+		condlog(0, "%s: couldn't get path. cannot resize", mapname);
+		return 1;
+	}
 	if (!pp->udev || sysfs_get_size(pp, &size)) {
 		condlog(0, "%s: couldn't get size for sysfs. cannot resize",
 			mapname);