From patchwork Thu Apr 7 02:10:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangguanghui X-Patchwork-Id: 8768101 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2EFBFC0554 for ; Thu, 7 Apr 2016 02:35:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39696201CD for ; Thu, 7 Apr 2016 02:35:27 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 033BA201B9 for ; Thu, 7 Apr 2016 02:35:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u372VhFn025161; Wed, 6 Apr 2016 22:31:44 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u372VgrJ017870; Wed, 6 Apr 2016 22:31:42 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u372Vgwj001781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Apr 2016 22:31:42 -0400 Received: from h3cmg01-ex.h3c.com (unknown [60.191.123.56]) by mx1.redhat.com (Postfix) with ESMTP id C24B57F089; Thu, 7 Apr 2016 02:31:39 +0000 (UTC) Received: from BJHUB02-EX.srv.huawei-3com.com (unknown [10.63.20.170]) by h3cmg01-ex.h3c.com with smtp id 4328_015e_e7929169_4bde_4c7e_9221_f4953c1948b5; Thu, 07 Apr 2016 10:11:08 +0800 Received: from H3CMLB14-EX.srv.huawei-3com.com ([fe80::f804:6772:bd71:f07f]) by BJHUB02-EX.srv.huawei-3com.com ([::1]) with mapi id 14.03.0248.002; Thu, 7 Apr 2016 10:10:57 +0800 From: Zhangguanghui To: "dm-devel-bounces@redhat.com" , "dm-devel@redhat.com" Thread-Topic: multipathd: segfault in multipathd cli_add_map() Thread-Index: AQHRkHHNjhPJiaU2a0+e/5aqz5m3mA== Date: Thu, 7 Apr 2016 02:10:55 +0000 Message-ID: References: <1459221194-23222-1-git-send-email-bmarzins@redhat.com>, <1459221194-23222-18-git-send-email-bmarzins@redhat.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.153.28.126] MIME-Version: 1.0 X-RedHat-Spam-Score: 2.501 ** (BAYES_60, HELO_DYNAMIC_DHCP, HTML_FONT_LOW_CONTRAST, HTML_MESSAGE, RDNS_NONE) 60.191.123.56 [60.191.123.56] 60.191.123.56 [60.191.123.56] X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.75 on 10.5.110.26 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] multipathd: segfault in multipathd cli_add_map() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk 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 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ------------------------------------------------------------------------------------------------------------------------------------- ???????????????????????????????????????? ???????????????????????????????????????? ???????????????????????????????????????? ??? This e-mail and its attachments contain confidential information from H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel --- multipath-tools-ecf84a8/multipathd/cli_handlers.c 2016-04-07 09:28:46.693622941 +0800 +++ patch/cli_handlers.c 2016-04-07 09:43:36.237622835 +0800 @@ -523,7 +523,8 @@ char * param = get_keyparam(v, MAP); int major, minor; char dev_path[PATH_SIZE]; - char *alias, *refwwid; + char *alias = NULL; + char *refwwid = NULL; int rc, count = 0; param = convert_dev(param, 0); @@ -565,8 +566,10 @@ return 1; } rc = ev_add_map(dev_path, alias, vecs); - FREE(alias); - FREE(refwwid); + if (alias) + FREE(alias); + if (refwwid) + FREE(refwwid); return rc; } @@ -577,7 +580,7 @@ char * param = get_keyparam(v, MAP); int major, minor; char dev_path[PATH_SIZE]; - char *alias; + char *alias = NULL; int rc; param = convert_dev(param, 0); @@ -600,7 +603,8 @@ return 0; } rc = ev_remove_map(param, alias, minor, vecs); - FREE(alias); + if (alias) + FREE(alias); return rc; }