Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2384342lqb; Mon, 27 May 2024 19:23:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKsuEvDjV3y8A6GMuoo+U0Pz1XIybm9zPlU6XXrX/q+jTI0O75F/Xh0DPv+cS7Tc7gdmoO92ngL15maajaePM1Xg1aNUqyUNKOMMnMvQ== X-Google-Smtp-Source: AGHT+IF5eWfSl0bVDW35SSD2sG5C3DG57RL12aufI0+T9uwPw3/KEgKFWreo14sAXLwWrAxS7SPH X-Received: by 2002:a05:6a00:4007:b0:6f3:f963:505f with SMTP id d2e1a72fcca58-6f8f2a4b288mr11921624b3a.5.1716863035956; Mon, 27 May 2024 19:23:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716863035; cv=pass; d=google.com; s=arc-20160816; b=Mi/NeY+IZx2X77SHqwbCqxCg+MZpv8jC94vSgQVJMK//PtCOu6s6NZUXQLAOMRDruN WRGL1O9EM7Rqa8YjqyzNsDBoqWLRv4Qq2476TLvMOXJU8uOFVmxgVKGzgn2XpRtEJJv6 mvy4EtfO5nyNlw5bm5UEztP4ZEnDQK60/GxvGFzex9/lS9s0CMln9fr2VQao3FGpqRVO J9fws4kqbIV86HgQTu058LJOl1xDvmI60gutmK6jyaleXLBQrf6EBO9C/vOIBVSzRvd8 YpN1sMZiZzVear4kUW6naiWITEp+NTtAEWNrrYeU7ofSatQtYB/0mzFbzENxFQnHUQbP qfqw== 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=lI16cG86ehVic80CrNtNLmA6e4l1FGbrxekucTHr0Og=; fh=Iq9LIsmVr3yAtqhKTW4BE7kvP7YGP1BDNY5izCSokfo=; b=obz2KAdCCOEauW4ghoYb3VNWZGPb5Z10AIRyWbIOdiDkEvFg9bv5aSeUGehf8mnTT3 V6vgb1azOqN1J0ZGPx7I3d4eLOlhAn0Ex8WFcF1JFSCaAkxeuw2O7ApAL7F+EhFDw5Dd h3631+ZjKSeFs+i6D+NNf0oLB0wF8AlThKn6OELo5xdBBAtReYpiKfq64HJGy+vEt8ca h5oJaHmeC6vAMNgUJ0aphSqw6joQgmfzKExMtj4fK4RGyPk5JVXxPcdHicMzullilQRh B1Rn8QMNusJHzNgdR0LHp6WNGpJ6MlT6V242cXODq2/9zTDIYTdf7b2lZCLG1RuBBA2h ncyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q+w/Z6Jp"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc051075si7129341b3a.26.2024.05.27.19.23.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 19:23:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q+w/Z6Jp"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191645-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3E46DB2084C for ; Tue, 28 May 2024 02:21:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F105502B9; Tue, 28 May 2024 02:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q+w/Z6Jp" 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 78DE44D59B; Tue, 28 May 2024 02:19:14 +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=1716862754; cv=none; b=Bl1M5vVWXdgsGyBCtFVXyyS8v7VTQe1qEOPR5l2fcO09sjFGNx+unRXtJoIiwTjmvpye1D7Svq4qVTbnabBx9ASbS8eOFU3Aw7Oo0gQAXAjGrH9Hq1l0Dy3tJFra9hj63huJp3W9dObdI+NpSfPpiiw7vzRs3M4Aeseyuv0jwwI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716862754; c=relaxed/simple; bh=Ai6O9eTJDkIJpA+tWGRVeg1IerME6NvfCXXrdyN+IMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y22fWyCo3tCD8u8NtsykH95gBkl7HxAqz/jnoR/lHXjVlWrRl/iHQzwu9mjnbd7in7rPNr5SzNFOM5XqmUhwnkCRO8BR9wIxYf4cJ7CMlaTEQa8wOD+yBuvjL8x7lv71DdFOVp3D2EGKoRhC9eWh5LfGvANTb83TirMOLmCAoMk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q+w/Z6Jp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF7A5C32782; Tue, 28 May 2024 02:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716862754; bh=Ai6O9eTJDkIJpA+tWGRVeg1IerME6NvfCXXrdyN+IMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+w/Z6JpuE209eFa5NNftiPXvA5uFt6zEQp9rqQBNKx0wAMinR+Faz9f6nRD62gW/ DnkqihegSACJ5KSp1nmvPuXeEdE+4wLPzQZDXMMHf/bl5X2tM+ib7COSxHKHtCuW9Q 2WaTiU6T+BjN1EpEflTBey8/8p0ixqmnVHFoDlP7H2KVS456fsJsANKM/M7xsYx7Wy kMSzKtKQ9a5uAihAr6/WJtTMjoz8WkqRmI0BNotTJgJFG3jifJTk+FFU/D/SArJp8S SI7nQnI4YBAyO56KxVdQ+r2MaSvUk9DJymRrdQ2g/GkA73R4bv7xd9qtH+z7gTrvM3 Al+QS+nSEmeDA== 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.1 2/2] iommu/arm-smmu-v3: Free MSIs in case of ENOMEM Date: Mon, 27 May 2024 22:19:08 -0400 Message-ID: <20240528021909.3905362-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240528021909.3905362-1-sashal@kernel.org> References: <20240528021909.3905362-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.1.92 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 82f100e591b5a..45b43f729f895 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3199,7 +3199,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