[{"id":3682015,"web_url":"http://patchwork.ozlabs.org/comment/3682015/","msgid":"<11154ecc-d49d-40cb-8437-a4e6af1420de@kernel.org>","list_archive_url":null,"date":"2026-04-24T12:42:00","subject":"Re: [PATCH 2/3] PCI: altera: fix resource leaks on probe failure","submitter":{"id":67867,"url":"http://patchwork.ozlabs.org/api/people/67867/","name":"Dinh Nguyen","email":"dinguyen@kernel.org"},"content":"Hi Mahesh,\n\nOn 4/24/26 04:49, Mahesh Vaidya wrote:\n> The chained IRQ handler is installed in altera_pcie_parse_dt() but\n> never unregistered on probe failure. If any subsequent step in\n> altera_pcie_probe() fails, devm frees the pcie struct while the\n> handler still references it. A subsequent interrupt would trigger\n> a use-after-free.\n> \n> The INTx IRQ domain created in altera_pcie_init_irq_domain() is\n> similarly leaked on probe failure, since the existing cleanup via\n> altera_pcie_irq_teardown() is only invoked from the remove path.\n> \n> Move the handler installation from altera_pcie_parse_dt() into\n> altera_pcie_probe() after the IRQ domain is created, and add a\n> goto-based error path so altera_pcie_irq_teardown() is called on\n> any failure after handler installation.\n> \n> Fixes: 60f2ee5f1472 (\"PCI: altera: Add Agilex support\")\n> Signed-off-by: Mahesh Vaidya <mahesh.vaidya@altera.com>\n> ---\n>   drivers/pci/controller/pcie-altera.c | 17 +++++++++++++++--\n>   1 file changed, 15 insertions(+), 2 deletions(-)\n> \nI think you should decouple this patch from this series.\n\nDinh","headers":{"Return-Path":"\n <linux-pci+bounces-53137-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=pKIgIXg9;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53137-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"pKIgIXg9\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2CL35dC6z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 22:43:07 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id A2A15300D15E\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 12:42:04 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 88166378D71;\n\tFri, 24 Apr 2026 12:42:03 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AF4835F5ED;\n\tFri, 24 Apr 2026 12:42:03 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id DDFC4C19425;\n\tFri, 24 Apr 2026 12:42:01 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777034523; cv=none;\n b=AU1tEtwMIuOwxDCBUUZk1X4RbbanljU33rhJnfhPSf8seYB/gX9ZC0jXjcjSf5w34ICFNlaUXJoC6j+BEow/Qq7Xu4koQrmYi6s8zYfwMvyLzHo7gZAIfC1R16y5J7VtdR3YZUrLrv23Xa2TXETXVHQzPK/oDhBOE/sNd1Q/8d0=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777034523; c=relaxed/simple;\n\tbh=t/Tps5bQrQ/STr7dbi97w6/FCKOkiYBJ9dzPh2A63Ks=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=qAuIH9U1NAPBMLuqCjm6SSWVTClxzXpYGIO+2ppe7g+3i9YpOmZTsvMnlgGcmjCPG4AtC/9eVkR1VZ8wYfze7eqCPsh51txKwAprebL4A0LJflU9STfJeFpcDI4eNgBfi+CXCBXoIk0J5+f9hXMyfAEeNgQX+3esUNEXD/0j3Gc=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=pKIgIXg9; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777034523;\n\tbh=t/Tps5bQrQ/STr7dbi97w6/FCKOkiYBJ9dzPh2A63Ks=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=pKIgIXg9vjHTamM6H/eqZUdo8ZkhcN3KEaekEIiDqKY+lu9LAKW1gKFmrqBmIYvO8\n\t OjyMP8k08Vh08EymgbCXesT/tyNXt/7rt1e8xwvJhqlVn5mPRjOgGzmCNU52u5UB4s\n\t 3lEbFmtgwO5vEaXDrz1p/HC6cjsAzn6nIPLYkT9UuaAWNnNiq+iqI1Y9EggSzRu2jl\n\t IVUaq1uv2m7YcFyGIVTmdiQUXZv6Rp+CdLB7JlLTvE8N0HNKNnSOjrEp2z0awh/jQ7\n\t Q/hsfpcXULJDUI3dgM5gvpNGvlhm7u2kUM7+MRGZet73tFSp5y/lIwXrjUsecsyV/7\n\t Lh9hcE3XyRXJg==","Message-ID":"<11154ecc-d49d-40cb-8437-a4e6af1420de@kernel.org>","Date":"Fri, 24 Apr 2026 07:42:00 -0500","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 2/3] PCI: altera: fix resource leaks on probe failure","Content-Language":"en-US","To":"Mahesh Vaidya <mahesh.vaidya@altera.com>, joyce.ooi@intel.com,\n lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org,\n robh@kernel.org, bhelgaas@google.com, krzk+dt@kernel.org, conor+dt@kernel.org","Cc":"linux-pci@vger.kernel.org, devicetree@vger.kernel.org,\n linux-kernel@vger.kernel.org, subhransu.sekhar.prusty@altera.com","References":"<20260424094913.522123-1-mahesh.vaidya@altera.com>\n <20260424094913.522123-3-mahesh.vaidya@altera.com>","From":"Dinh Nguyen <dinguyen@kernel.org>","In-Reply-To":"<20260424094913.522123-3-mahesh.vaidya@altera.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit"}}]