From patchwork Thu Apr 16 23:48:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 18579 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3GNmhbH011713 for ; Thu, 16 Apr 2009 23:48:43 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 4CF1E619B46; Thu, 16 Apr 2009 19:48:43 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n3GNmewQ021243 for ; Thu, 16 Apr 2009 19:48:40 -0400 Received: from hs20-bc2-1.build.redhat.com (hs20-bc2-1.build.redhat.com [10.10.28.34]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3GNmeoI025662; Thu, 16 Apr 2009 19:48:40 -0400 Received: from hs20-bc2-1.build.redhat.com (localhost.localdomain [127.0.0.1]) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1) with ESMTP id n3GNmePa000343; Thu, 16 Apr 2009 19:48:40 -0400 Received: from localhost (mpatocka@localhost) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1/Submit) with ESMTP id n3GNmeHF000337; Thu, 16 Apr 2009 19:48:40 -0400 X-Authentication-Warning: hs20-bc2-1.build.redhat.com: mpatocka owned process doing -bs Date: Thu, 16 Apr 2009 19:48:40 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@hs20-bc2-1.build.redhat.com To: Alasdair G Kergon In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 2/2] crash in multipath argument parsing X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 --- drivers/md/dm-mpath.c | 5 +++++ 1 file changed, 5 insertions(+) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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) {