Skip to contentSkip to conversation

dm mpath: fix potential NULL pointer in feature arg processing

PATCH New Mike Snitzer 1 participant 1 message Jun 28, 2011 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm mpath: fix potential NULL pointer in feature arg processing

If a user specifies an mpath target as having 1 or more features but doesn't specify the corresponding feature args a NULL pointer occurs in parse_features() -- @param_name is NULL when passed to strnicmp().

---
 drivers/md/dm-mpath.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/md/dm-mpath.c +5 -0
index aa4e570..209991b 100644
@@ -807,6 +807,11 @@ static int parse_features(struct arg_set *as, struct multipath *m)
 	if (!argc)
 		return 0;
 
+	if (argc > as->argc) {
+		ti->error = "not enough arguments for features";
+		return -EINVAL;
+	}
+
 	do {
 		param_name = shift(as);
 		argc--;
Signature · 1 line
1.7.4.4