From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC04C4709A for ; Thu, 3 Jun 2021 17:09:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B99A61422 for ; Thu, 3 Jun 2021 17:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbhFCRL3 (ORCPT ); Thu, 3 Jun 2021 13:11:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:41888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbhFCRKs (ORCPT ); Thu, 3 Jun 2021 13:10:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 567AF613F4; Thu, 3 Jun 2021 17:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622740143; bh=BzaYx7fpMsxsiOeTmJBdfTpVjnWGpnleTHfSLKwCxIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oJZN1U8j0qsVcbtFQ6BRAp8FmCw8woMRWvoTt9rtC1+w+X8aUuvAQJOUsiYEsXhnj kiJkvR01tFNx7gWUSPBCsLAoxZ94h4FARYITCNpVFkMCVzNvWUGV/8TRbfMXqRLV9D 07O1+DLVWvRqN9i+xaJYC0MWwDzDSelg9letg7JcERr8vdaNdBvdVSt/ZpwpayCdsh ifODSZmksbHrhtLGS97r7vrOTyMOjOlXkM4MwyWJSNkDzvTZz8Nnb1n8VMAscK9qaR kbos+HGyndBAHXIKM0JVb/m0JBykafMbo+s9/WA/o4/vmTouoyn9JlsOKacILWJPiC F8qPE8Mdzq+ww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Yingliang , Hulk Robot , John Garry , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 27/39] scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irq Date: Thu, 3 Jun 2021 13:08:17 -0400 Message-Id: <20210603170829.3168708-27-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210603170829.3168708-1-sashal@kernel.org> References: <20210603170829.3168708-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Yang Yingliang [ Upstream commit 7907a021e4bbfa29cccacd2ba2dade894d9a7d4c ] irqs allocated with devm_request_irq() should not be freed using free_irq(). Doing so causes a dangling pointer and a subsequent double free. Link: https://lore.kernel.org/r/20210519130519.2661938-1-yangyingliang@huawei.com Reported-by: Hulk Robot Acked-by: John Garry Signed-off-by: Yang Yingliang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 19170c7ac336..e9a82a390672 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3359,14 +3359,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba) { int i; - free_irq(pci_irq_vector(pdev, 1), hisi_hba); - free_irq(pci_irq_vector(pdev, 2), hisi_hba); - free_irq(pci_irq_vector(pdev, 11), hisi_hba); + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba); + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba); + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba); for (i = 0; i < hisi_hba->cq_nvecs; i++) { struct hisi_sas_cq *cq = &hisi_hba->cq[i]; int nr = hisi_sas_intr_conv ? 16 : 16 + i; - free_irq(pci_irq_vector(pdev, nr), cq); + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq); } pci_free_irq_vectors(pdev); } -- 2.30.2