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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B01EE743FE for ; Fri, 29 Sep 2023 09:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232887AbjI2JOc (ORCPT ); Fri, 29 Sep 2023 05:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbjI2JOb (ORCPT ); Fri, 29 Sep 2023 05:14:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B961A5; Fri, 29 Sep 2023 02:14:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D00F0C433C9; Fri, 29 Sep 2023 09:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695978867; bh=NTN/RQYG6P0QoAel8GV/8O73av4VLPmH4PrU0s1SWGM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=D4kHiYLlhSwU2skHyR+SodGJrSbjPJPESqifyCsymu2WrqHtQeO+mHQmji92js/Ow WxNe1LGlaO2U5TBs2DpxfDMsAuFoHCfsOlQ0D1iCUSh/4dUUXHWMnTbJ+PprHVXvUp utDwsNKaEoTrX23X7YG67Gs14Sk8UmUNg3/GyRncnWpEzsRcY0qkDzXAbNekFqqRFG JUo13LiRpIPYo4u31MMC2BfoqcAvan9Shd2Y/Uuc9Ub8lmYtjk/CSOkfBMoU8idDws a4NTBPar99BLErcQxEzK1du61fjut8Ep2ZbD+e9hmD46P6ssYn0OH3CPKKRUw/+D36 FnIicUOcduO6Q== Received: from [85.255.233.37] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qm9Zk-00HCUP-52; Fri, 29 Sep 2023 10:14:20 +0100 Date: Fri, 29 Sep 2023 10:14:18 +0100 Message-ID: <87jzs9mjdh.wl-maz@kernel.org> From: Marc Zyngier To: Dinghao Liu Cc: Toan Le , Lorenzo Pieralisi , Krzysztof =?UTF-8?B?V2lsY3p5xYRza2k=?= , Rob Herring , Bjorn Helgaas , Duc Dang , Tanmay Inamdar , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: xgene-msi: Fix a potential UAF in xgene_msi_probe In-Reply-To: <20230926025936.7115-1-dinghao.liu@zju.edu.cn> References: <20230926025936.7115-1-dinghao.liu@zju.edu.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 85.255.233.37 X-SA-Exim-Rcpt-To: dinghao.liu@zju.edu.cn, toan@os.amperecomputing.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, dhdang@apm.com, tinamdar@apm.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, 26 Sep 2023 03:59:36 +0100, Dinghao Liu wrote: > > xgene_allocate_domains() will call irq_domain_remove() to free > msi->inner_domain on failure. However, its caller, xgene_msi_probe(), > will also call irq_domain_remove() through xgene_msi_remove() on the > same failure, which may lead to a use-after-free. Remove the first > irq_domain_remove() and let xgene_free_domains() cleanup domains. > > Fixes: dcd19de36775 ("PCI: xgene: Add APM X-Gene v1 PCIe MSI/MSIX termination driver") > Signed-off-by: Dinghao Liu > --- > > Changelog: > > v2: -Remove irq_domain_remove() instead of nulling msi_domain. Unfortunately, your email doesn't indicate this is v2. M. -- Without deviation from the norm, progress is not possible. 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F674E743FE for ; Fri, 29 Sep 2023 09:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hnqcIfvSBJzQ/2l0mmcGd5X/kEysJHqeW+3aAq7rmgA=; b=jDNUnOtj2Thh57 4OlikwVjse9LknrzVytsqovPr9MbzG5U+/K0cwYZA/rWXuqY68JLlFgYSj2UA1eEqbQSXUsAfu8vI 6rzRZ7sE5NFuiXGe/B+LxDCW7zFw6iYWsJZvmh2QzioIHFt5WLlLVX28uIVltgS8SitE9CUYdPdB7 01+cc/aecBv9/IltJo2koxXb4PgJOmf37M8SOojOhfzFiqBIiEhjXHKGUOIhjY777hSfSN3QkZm/+ S74CxEiIxCQIMnq6Baa8P6oTMHgh3QqX+VfoS8RKcht1mxNhYkIpZhP4ezXoUL7tWBz4CNz6BJNWl XA7GlshdPAHJMOOPMdzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qm9Zx-007Rv5-1L; Fri, 29 Sep 2023 09:14:33 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qm9Zt-007Ruf-2u for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2023 09:14:32 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 88517B81AC7; Fri, 29 Sep 2023 09:14:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D00F0C433C9; Fri, 29 Sep 2023 09:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695978867; bh=NTN/RQYG6P0QoAel8GV/8O73av4VLPmH4PrU0s1SWGM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=D4kHiYLlhSwU2skHyR+SodGJrSbjPJPESqifyCsymu2WrqHtQeO+mHQmji92js/Ow WxNe1LGlaO2U5TBs2DpxfDMsAuFoHCfsOlQ0D1iCUSh/4dUUXHWMnTbJ+PprHVXvUp utDwsNKaEoTrX23X7YG67Gs14Sk8UmUNg3/GyRncnWpEzsRcY0qkDzXAbNekFqqRFG JUo13LiRpIPYo4u31MMC2BfoqcAvan9Shd2Y/Uuc9Ub8lmYtjk/CSOkfBMoU8idDws a4NTBPar99BLErcQxEzK1du61fjut8Ep2ZbD+e9hmD46P6ssYn0OH3CPKKRUw/+D36 FnIicUOcduO6Q== Received: from [85.255.233.37] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qm9Zk-00HCUP-52; Fri, 29 Sep 2023 10:14:20 +0100 Date: Fri, 29 Sep 2023 10:14:18 +0100 Message-ID: <87jzs9mjdh.wl-maz@kernel.org> From: Marc Zyngier To: Dinghao Liu Cc: Toan Le , Lorenzo Pieralisi , Krzysztof =?UTF-8?B?V2lsY3p5xYRza2k=?= , Rob Herring , Bjorn Helgaas , Duc Dang , Tanmay Inamdar , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: xgene-msi: Fix a potential UAF in xgene_msi_probe In-Reply-To: <20230926025936.7115-1-dinghao.liu@zju.edu.cn> References: <20230926025936.7115-1-dinghao.liu@zju.edu.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 85.255.233.37 X-SA-Exim-Rcpt-To: dinghao.liu@zju.edu.cn, toan@os.amperecomputing.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, dhdang@apm.com, tinamdar@apm.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230929_021430_074959_17A2355F X-CRM114-Status: GOOD ( 13.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 26 Sep 2023 03:59:36 +0100, Dinghao Liu wrote: > > xgene_allocate_domains() will call irq_domain_remove() to free > msi->inner_domain on failure. However, its caller, xgene_msi_probe(), > will also call irq_domain_remove() through xgene_msi_remove() on the > same failure, which may lead to a use-after-free. Remove the first > irq_domain_remove() and let xgene_free_domains() cleanup domains. > > Fixes: dcd19de36775 ("PCI: xgene: Add APM X-Gene v1 PCIe MSI/MSIX termination driver") > Signed-off-by: Dinghao Liu > --- > > Changelog: > > v2: -Remove irq_domain_remove() instead of nulling msi_domain. Unfortunately, your email doesn't indicate this is v2. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel