[dm-devel] [PATCH 2/2] crash in multipath argument parsing

Mikulas Patocka mpatocka at redhat.com
Thu Apr 16 23:48:40 UTC 2009


Fix possible parsing error in hw handlers.

When making the previous patch I reviewed the code and found a similar
possible crash in hardware handler parsing. I didn't try it though, because
I don't have hardware multipath.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/md/dm-mpath.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6.30-rc1-devel/drivers/md/dm-mpath.c
===================================================================
--- linux-2.6.30-rc1-devel.orig/drivers/md/dm-mpath.c	2009-04-10 06:33:57.000000000 +0200
+++ linux-2.6.30-rc1-devel/drivers/md/dm-mpath.c	2009-04-10 06:34:00.000000000 +0200
@@ -705,6 +705,11 @@ static int parse_hw_handler(struct arg_s
 	if (!hw_argc)
 		return 0;
 
+	if (hw_argc > as->argc) {
+		ti->error = "not enough arguments for hardware handler";
+		return -EINVAL;
+	}
+
 	m->hw_handler_name = kstrdup(shift(as), GFP_KERNEL);
 	request_module("scsi_dh_%s", m->hw_handler_name);
 	if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {




More information about the dm-devel mailing list