Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbbBKE6b (ORCPT ); Tue, 10 Feb 2015 23:58:31 -0500 Received: from foss-mx-na.arm.com ([217.140.108.86]:43005 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbbBKE6a (ORCPT ); Tue, 10 Feb 2015 23:58:30 -0500 From: Lorenzo Pieralisi To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: jiang.liu@linux.intel.com, Lorenzo Pieralisi , Bjorn Helgaas , "Rafael J. Wysocki" Subject: [PATCH] drivers: of: pci: remove duplicate kfree in of_pci_get_host_bridge_resources Date: Wed, 11 Feb 2015 04:58:35 +0000 Message-Id: <1423630715-23568-1-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.2.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1605 Lines: 40 Commit d2be00c0fb5a ("of/pci: Free resources on failure in of_pci_get_host_bridge_resources()") fixed the error code path in of_pci_get_host_bridge_resources() by adding code that runs through the resources list to free all resources in it and then calls kfree on the bus_range resource pointer to complete the memory deallocation. Since the bus_range resource is added to the resources list through pci_add_resource, the resource_list_for_each_entry loop in the error exit path frees it already and freeing it anew could trigger a double free, hence this patch removes the superfluos kfree call on the bus_range resource. Fixes: d2be00c0fb5a ("of/pci: Free resources on failure in of_pci_get_host_bridge_resources()") Signed-off-by: Lorenzo Pieralisi Reported-by: Jiang Liu Cc: Bjorn Helgaas Cc: Rafael J. Wysocki --- drivers/of/of_pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 110fece..62426d8 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -229,7 +229,6 @@ parse_failed: resource_list_for_each_entry(window, resources) kfree(window->res); pci_free_resource_list(resources); - kfree(bus_range); return err; } EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources); -- 2.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/