From patchwork Thu May 2 21:46:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 2514021 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id D4AEA3FCA5 for ; Thu, 2 May 2013 21:51:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r42LlwQ3024497; Thu, 2 May 2013 17:47:58 -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 r42LknUq028827 for ; Thu, 2 May 2013 17:46:49 -0400 Received: from ether.msp.redhat.com (ether.msp.redhat.com [10.15.80.119]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r42LkmLt028802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 May 2013 17:46:49 -0400 Received: from ether.msp.redhat.com (localhost.localdomain [127.0.0.1]) by ether.msp.redhat.com (8.14.1/8.14.1) with ESMTP id r42LklwS009027; Thu, 2 May 2013 16:46:48 -0500 Received: (from bmarzins@localhost) by ether.msp.redhat.com (8.14.1/8.14.1/Submit) id r42LklM7009026; Thu, 2 May 2013 16:46:47 -0500 From: Benjamin Marzinski To: device-mapper development Date: Thu, 2 May 2013 16:46:27 -0500 Message-Id: <1367531197-8987-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1367531197-8987-1-git-send-email-bmarzins@redhat.com> References: <1367531197-8987-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 06/16] Fix hardware entry matching code X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com When a user defined hardware table entry's identifiers exactly match a built-in one's, the built-in one is removed, and the list is rescaned. However, the built-in entry is not freed, and on the rescan, the first user defined entry is treated as a built-in entry. This patch frees the built-in entry, and decrements the number of built-in entries, so that the rescan works as expected. Signed-off-by: Benjamin Marzinski --- libmultipath/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmultipath/config.c b/libmultipath/config.c index 25d3e3d..da676df 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -436,6 +436,8 @@ restart: merge_hwe(hwe2, hwe1); if (hwe_strmatch(hwe2, hwe1) == 0) { vector_del_slot(hw, i); + free_hwe(hwe1); + n -= 1; /* * Play safe here; we have modified * the original vector so the outer