Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2383180lqb; Mon, 27 May 2024 19:19:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkVmpI/DoYoYWt1dor8LxzzH43V0j28AW5rUYXhnidATvXEyIxEC3/GfgASSTmAO4Ih29cbDqsG9hRYPTABCwxxbx9TOwYEVKIeQ5UhA== X-Google-Smtp-Source: AGHT+IG1hsY76JJyMcQdrMtWzKJxp/RU4Ez7iUJN2CIBHsLP4hcb6JzMAYJQyQ1zbU+XcwMJvb9H X-Received: by 2002:a05:6214:4602:b0:6ab:99df:4106 with SMTP id 6a1803df08f44-6abbbccf36cmr114532386d6.36.1716862786730; Mon, 27 May 2024 19:19:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716862786; cv=pass; d=google.com; s=arc-20160816; b=G6082t4HvKWKB9aYwlBWhDQr26SR9WiBN7e/P6gX+HAEb5uOr3LUHqdBpMWqwPiK9F +ZqwBkdatXmQbnUwlJmuQ+Xnz8xbvtklTyqez9rDwqiXc/TRBTO7W6iLlYWrOGmsAset PH7xL62qqdIZjBWhbDNvQlfWVxaowcx9TA+UBS3Bv/29TxiJIDC36VEMm8VLr5HsSHK4 yqNwT4rPGzVenJUgkUOB6Tkd172Txyq+g3qhAZKaD/lrhEKtwp1CiGZWeN4iP7M+ep94 0qXxqKViV9snBCzEUlh+P8n4YJQKxmUMqyJBNgT5EwPL8r+HOlNCDyEyWiRUwlwKsW7u NIbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Z6mCoaUNDVZt6NVD2TIMpiUn6QOmq++qy4ryuI7BYpc=; fh=Iq9LIsmVr3yAtqhKTW4BE7kvP7YGP1BDNY5izCSokfo=; b=b6/GY3zp9h0LrxONIvOGg4847cnFNwk3TOTT8aAq3ifFhQHFHgkefBA8hA/rRFHl+Q 9USQykPnynNk6RufL55UU2+XD1DBUeaUpsXgsOMvyjVB5hvAgEfVRH8eGC+cKyDOkSBS 7oPZblxU9WMBtgi1n6Ba8f57vEtLvsko8pyd9TIkbE1H5aEr4HhLdMip+OnCErXPYuH6 DGervKxyJWPKXmtRV+KqhUpumfFytMv3OQ45D5+z/ZAjwy1ghEigqT9nhhbDzrG+4XNX ZpTKaTKdgV2z68n5SSNtTJLM+n+4mMoLYk7tDoKftz4ieruQAfmTV4xTm6RUtzTfmZvM p5HA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VLlJL66q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191637-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac070f1466si95880036d6.280.2024.05.27.19.19.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 19:19:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VLlJL66q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191637-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 74D7F1C21A81 for ; Tue, 28 May 2024 02:19:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07CF92E84A; Tue, 28 May 2024 02:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VLlJL66q" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C14229402; Tue, 28 May 2024 02:18:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716862726; cv=none; b=ByXcv5sojew2K8iNPNElZnLUGQlLLPx3SuxNrMyX8Xg95xrerGrVdUVaa+1k51Y0XMUJd2JjJI7/AG0hpMtcf2LjOREte0eKJdj6aGFzbzf0EgTfwX+KYgWGNEcCZs+DFhUuq7L7/MFt86N84fh1vpdAbJMFc5vomFqwhlCe+XA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716862726; c=relaxed/simple; bh=/y3TuOamaSzqh7hV7VFaWnajUt2YPaIpzkp8Ve5If5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VlWSPHd9vL6hFYCLcqkTndZBsnJ5F6Xm8WpTH7fkbFSQGC8mTh3NI+cwQRp7nWkyKfQoMLcS0N4xlbxQGHf/p8JVSXIf/27fwnSABTVmPmCd+PjQwsjsgLh705/k44TIDGLA1iTMsZMCjsJKKqAEkTfC2D7R4/1goHp7PF0TuY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VLlJL66q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92E6FC4AF07; Tue, 28 May 2024 02:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716862725; bh=/y3TuOamaSzqh7hV7VFaWnajUt2YPaIpzkp8Ve5If5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLlJL66qm50OVnDbMixs6fJE9U8qA3vTWbtHvJnn4ATlBxXhkEIDd3zdRFpaGBSkI j1DaIz3wjH2F/4wl3QRH+KoJzh5avILv9TxwwA+hDoFjz3wdtfXRFl0WoI6eGPBIuG X14AcqJrkqm91hFV3bDyjAwsTPgHTggD6yKTZATN7LWObd8bDcRK7Dqo8LyM6Sc92n 3jfQ8XF8zCmliPnb+0QvYGdJ6O5eyA9a4+Z4mkdWJ5aEaTE3iY8wZMINPdwGyPFvXS s2PhgBjW7ZcZYJuNht6BXtvSI1uoCEQmzms9nogj+4A1sDsoVBpinMwt3y7UH5f666 lcNkCCJJ+sGfg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aleksandr Aprelkov , Will Deacon , Sasha Levin , joro@8bytes.org, iommu@lists.linux-foundation.org Subject: [PATCH AUTOSEL 6.8 2/4] iommu/arm-smmu-v3: Free MSIs in case of ENOMEM Date: Mon, 27 May 2024 22:18:37 -0400 Message-ID: <20240528021840.3905128-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240528021840.3905128-1-sashal@kernel.org> References: <20240528021840.3905128-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.11 Content-Transfer-Encoding: 8bit From: Aleksandr Aprelkov [ Upstream commit 80fea979dd9d48d67c5b48d2f690c5da3e543ebd ] If devm_add_action() returns -ENOMEM, then MSIs are allocated but not not freed on teardown. Use devm_add_action_or_reset() instead to keep the static analyser happy. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Aleksandr Aprelkov Link: https://lore.kernel.org/r/20240403053759.643164-1-aaprelkov@usergate.com [will: Tweak commit message, remove warning message] Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index f3f2e47b6d488..5071a8495a78c 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3181,7 +3181,7 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu) smmu->priq.q.irq = msi_get_virq(dev, PRIQ_MSI_INDEX); /* Add callback to free MSIs on teardown */ - devm_add_action(dev, arm_smmu_free_msis, dev); + devm_add_action_or_reset(dev, arm_smmu_free_msis, dev); } static void arm_smmu_setup_unique_irqs(struct arm_smmu_device *smmu) -- 2.43.0