Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2655741pxj; Mon, 14 Jun 2021 04:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAByRRJhTFlAlWCvKTwT8qh3CCV9FhBHem5um6BB1y7aHrDl5e4xTxCgIIkFq3/2CzmmVq X-Received: by 2002:aa7:de18:: with SMTP id h24mr16272932edv.23.1623669028379; Mon, 14 Jun 2021 04:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669028; cv=none; d=google.com; s=arc-20160816; b=GLcbVs4zu4A8WDH0HKt8grosRACcm+xXgJNI3w2a8Te1drf91aerxYL5iIwvkphydm nCcIYElWbhQ3aYspUVXQmeeJMOIIeiJ3tGfrApRQuMGeBEa6DCtyxdvccYkXy+SgcyRg +st/MDajTbDIcdtaTy3lJ7lrvLD/dcr3sSxUJgzAChJIdzulfstzCH4kc4+HXtoSeR04 mLn4kYHhD5jC/v3Yiv5j7/1jBmuKvznlIk9VectJDf2gM0lwdn0kLGxksf7mirPe+Sag c+9kgzdzgUy6a6yttyzb81xhQnZSqPMWFVlArm38hSJtyPjiYLRpXp8gPgKw0b5ReFtu AsnA== 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=vcBHphWDmx2CSRRediV0co+SXIwQJblp8CqFs0CReFw=; b=w053R7rkn5G9DHArRYnWlBufkbf9Y5/e2ieBWal5hXyapuKJlFBoAu7e9EgOGFFeXw VSQdhOsExcyTWGvTy3EYal/H3hqdajhcf+Vm/7iufQ+/q6bR9OliK84OAXS9sWX7LM3m ymy6zDpwE1WtUltIPJwwqnPyI5PLj678MmHNnG7169p3XKmDYAt3svf7D5jW9CMxwTBq N2m7h5SZBzhAZmrxWD/TCD0p/lvcr7K1Y8e4FB6yoY++KPv2F27TsBI2bSUZKZ+emtPk 31ewtfc8FcAYtSCusKFDKGAqc5obgGvU8BJr6b3FTTY+/LY1Fjf+9tB89aigZ+fExyWg my3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="I7ma/JER"; 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 h12si10842844ejc.216.2021.06.14.04.10.05; Mon, 14 Jun 2021 04:10:28 -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="I7ma/JER"; 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 S235350AbhFNLJl (ORCPT + 99 others); Mon, 14 Jun 2021 07:09:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234667AbhFNK6z (ORCPT ); Mon, 14 Jun 2021 06:58:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E2606142E; Mon, 14 Jun 2021 10:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667328; bh=BzaYx7fpMsxsiOeTmJBdfTpVjnWGpnleTHfSLKwCxIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7ma/JERoU7kXF0DSSL+1DFv5/DZY6+xqVOHXBy0TwvUeXe+UKlj0Dp+NiRHgXbi8 D5PbQpZpQ1l6FzvuqmfxFK+oaYhlgkx5wJ3+0lIP489skk/E1cyzyKGCbLhxLoBIhK OGEzl+Jxb0ma04rZrRd+SswRLR2WOejH19/6Thls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , John Garry , Yang Yingliang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 028/131] scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irq Date: Mon, 14 Jun 2021 12:26:29 +0200 Message-Id: <20210614102653.961626619@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@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: 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