From patchwork Tue Jun 7 14:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaohui Zhang X-Patchwork-Id: 12872035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5DA0C43334 for ; Tue, 7 Jun 2022 14:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244715AbiFGOvz (ORCPT ); Tue, 7 Jun 2022 10:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236152AbiFGOvy (ORCPT ); Tue, 7 Jun 2022 10:51:54 -0400 Received: from smtp.ruc.edu.cn (m177126.mail.qiye.163.com [123.58.177.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3848F504B; Tue, 7 Jun 2022 07:51:48 -0700 (PDT) Received: from localhost.localdomain (unknown [202.112.113.212]) by smtp.ruc.edu.cn (Hmail) with ESMTPSA id F14B280053; Tue, 7 Jun 2022 22:51:43 +0800 (CST) From: Xiaohui Zhang To: Xiaohui Zhang , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] scsi: bvme6000_scsi: Fix a resource leak in bvme6000_device_remove() Date: Tue, 7 Jun 2022 22:51:38 +0800 Message-Id: <20220607145138.10766-1-xiaohuizhang@ruc.edu.cn> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUJCSEtWSUNOH0gYH0tMHh pDVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSUtDTk1VS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6K1E6Mhw5Ej06VhcqFTACDTUM DTlPC0xVSlVKTU5PTUpITktPTktOVTMWGhIXVQMSGhQTDhIBExoVHDsJDhhVHh8OVRgVRVlXWRIL WUFZSUtJVUpKSVVKSkhVSUpJWVdZCAFZQUpDTEg3Bg++ X-HM-Tid: 0a813ea670a52c20kusnf14b280053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Similar to the handling of zorro7xx_remove_one in commit 16ed828b872d ("scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one()"), we thought a patch might be needed here as well. The error handling path of the probe releases a resource that is not freed in the remove function. In some cases, a ioremap() must be undone. Add the missing iounmap() call in the remove function. Signed-off-by: Xiaohui Zhang --- drivers/scsi/bvme6000_scsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index 8d72b25535c5..773254c9315b 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c @@ -97,6 +97,8 @@ bvme6000_device_remove(struct platform_device *dev) scsi_remove_host(host); NCR_700_release(host); + if (host->base > 0x01000000) + iounmap(hostdata->base); kfree(hostdata); free_irq(host->irq, host);