Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353940pxb; Mon, 20 Sep 2021 19:52:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjXVgU5OaJkXMrHGUvhLYlINYb3bNpgku7+gbrmyiYgq2B4xbZapMGCB/DH8goxThaphJO X-Received: by 2002:a17:906:cd19:: with SMTP id oz25mr32431313ejb.404.1632192772175; Mon, 20 Sep 2021 19:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192772; cv=none; d=google.com; s=arc-20160816; b=jMVe4wJESVCdfHpRuwtQyW1gM3K6TxBfJbtIW+cCFVH4uKNLpYVHWcA69nIp86k1kX wGUimyEdlqH3zL5nrM3nc1PZbVJwicl0BybrdzuWV1YA4J8y4HrxCnEmbA69rveH2n1T GuHurjaOgcrdV7H8dF4L/dgp4jPpeJe3xpVrq5nm6CRZ4CuqlEe/4afzoCPYfF0xMjhh TSwZIPkfynO1XuaRoA7md0o5F036QyJ0hfAyj5MUbvG5MSGBmCIc8Bp88gex1TpS4sv5 bK+tqRy4eZ1KqefpAszLzf7+hviVE6hUpVNJNgN5eelojCZ98qcJExKj75Vog0L2HI+H ZqrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ptDSc1gtd56ImZBabrpN2GBN/NonA+RREeCHEbN9UT4=; b=yHAUPVeTVQ8EDyia4IvYGDEIh2xnuKzXslf9znLXledgu2AlAZYtLRbzQnAG+qYNaA Tb6Y6cPJY53JgCI7Mukga0ArrSYbcIrn52dydt/GRHDGC2SugcC4w0D/e+riQzxHor10 +AdeoMJygmZz7G80mfBX2HAI9VOIJlmSylrpwuttbLeubCF5ZHHdFRcuWKlg/TYWima/ CuikIeA07HCTBHoysVD4MmDk1TevgeRM+vPLVZnpcI6Oa7DVo2utKSM5kd8ou2fXeMEA Qinkxzu0uwCjEPkMxS0CKB1vCAnP64PP0+jC4WABHpa9sQgxx6MSzQ+s+4Dc110NMRae tM5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ktGiPhbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si18491670edx.536.2021.09.20.19.52.28; Mon, 20 Sep 2021 19:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ktGiPhbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354632AbhITSvn (ORCPT + 99 others); Mon, 20 Sep 2021 14:51:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:59828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383896AbhITSqP (ORCPT ); Mon, 20 Sep 2021 14:46:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8DB86335D; Mon, 20 Sep 2021 17:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159181; bh=Jw4U4ftzzDsPSsfXsuww/SwEe7hHyW068K7bPWkIikw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktGiPhbDdXa4t9j40kcGMXdzsZjH2hPunF38Yin9HAp3xllbLohG7Nh5LFTPdd4N8 1PPWnh3nSY4YRYXqRPv9iriJKpdwgNQumfQ+i+oUl6FB4RZAoHaHe0sR/8P7B+kzDC jEkSotohQpfwqL2ItW/yF6iT6SsWpX8b67G3L3i0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vishal Aslot , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.14 114/168] PCI: ibmphp: Fix double unmap of io_mem Date: Mon, 20 Sep 2021 18:44:12 +0200 Message-Id: <20210920163925.385330820@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vishal Aslot [ Upstream commit faa2e05ad0dccf37f995bcfbb8d1980d66c02c11 ] ebda_rsrc_controller() calls iounmap(io_mem) on the error path. Its caller, ibmphp_access_ebda(), also calls iounmap(io_mem) on good and error paths. Remove the iounmap(io_mem) invocation from ebda_rsrc_controller(). [bhelgaas: remove item from TODO] Link: https://lore.kernel.org/r/20210818165751.591185-1-os.vaslot@gmail.com Signed-off-by: Vishal Aslot Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/hotplug/TODO | 3 --- drivers/pci/hotplug/ibmphp_ebda.c | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index a32070be5adf..cc6194aa24c1 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -40,9 +40,6 @@ ibmphp: * The return value of pci_hp_register() is not checked. -* iounmap(io_mem) is called in the error path of ebda_rsrc_controller() - and once more in the error path of its caller ibmphp_access_ebda(). - * The various slot data structures are difficult to follow and need to be simplified. A lot of functions are too large and too complex, they need to be broken up into smaller, manageable pieces. Negative examples are diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 11a2661dc062..7fb75401ad8a 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c @@ -714,8 +714,7 @@ static int __init ebda_rsrc_controller(void) /* init hpc structure */ hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); if (!hpc_ptr) { - rc = -ENOMEM; - goto error_no_hpc; + return -ENOMEM; } hpc_ptr->ctlr_id = ctlr_id; hpc_ptr->ctlr_relative_id = ctlr; @@ -910,8 +909,6 @@ error: kfree(tmp_slot); error_no_slot: free_ebda_hpc(hpc_ptr); -error_no_hpc: - iounmap(io_mem); return rc; } -- 2.30.2