Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2385728lqb; Mon, 27 May 2024 19:29:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzmMrXLqpMstFcvNHQICUIHF5N0lFm/38ckZ/RPlmrgF2lCcJ4CBmGs4G7wgKUZWFpohgSmWHU/8rmuR0cmECc+89ad3dqn19F2TfjAw== X-Google-Smtp-Source: AGHT+IEUbHUkeDQrpZayM8k0hQhWmzkrH0naBvaES1OkWf57LeDrGcPBx74Ovpx/D2wj39atLn41 X-Received: by 2002:a05:651c:50d:b0:2e2:ee3c:40f9 with SMTP id 38308e7fff4ca-2e95b27b13fmr71727031fa.43.1716863390870; Mon, 27 May 2024 19:29:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716863390; cv=pass; d=google.com; s=arc-20160816; b=U6bwYs62a7dPZ/z0GIuH7boOVPSYuwEUT4ByIl9AKhByca2HSWnBWlY1qju+Eztggx XXyhjj+/hyiV7Je31gwRZXzQRoRygKpj7zQEw4DoGowlR0GYZIXU/fwgpV9cQ+f/dN1P o0GlFrb6WGoP7W5FPwCvk89vhvEUNK3cpxveHt57it4OXE91BtPhaaM6C6G1W50Sq1GF vVYcr5Kk1+aeVyQBNxAAdHwUaMGWA+bIHC9cKkEA9vCZVfFiM+q2Q+MqCP0rDmY5q12k wojBGzsGFM84Hyfx1JqJw5tW8PyyRa8HLfRC05/M8gYjT8r2RwUce230mhQtOCv8wCIF 9biw== 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=ao5kxOLJdPoWpdPNOaxkQ2G4w7+luUOte41qntnkz/E=; fh=Iq9LIsmVr3yAtqhKTW4BE7kvP7YGP1BDNY5izCSokfo=; b=JPJ7gTzZXM46/DHM4MuRoBAZDO7fp3wwhO9aZHPAs0qGnJnrN1GdzJz78sMDEwZoXw sPdIL5KFAcmTJ/7+Jb3RmvGgeWrgdJeIE1rxs1C4N+rw554ldz+LwjwqhZ73vjXHc+Kh Y8+lUt4OTpdm8JDOJu/cwavtjTRuB2cR9Y7/3VdFazxHbpSzCtm3MtzSI2ghlNi3qgS1 vdbxkwVGU3pp3e0E0/CANsycFMHeJPhtA1DDOTdNDbMbxil/MDQ2s0PPFqtZLahVk4z+ AuO+/8hX7luY7oTNLQK/ZhzECloUyJwtl0Gw8ltPhtJcUG4Ul2v5hMgxfLkjjsPKdaQZ YByw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G3VEKN7V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191632-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-579c0082468si3082091a12.355.2024.05.27.19.29.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 19:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G3VEKN7V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191632-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 070251F23908 for ; Tue, 28 May 2024 02:18:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8A2214F70; Tue, 28 May 2024 02:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G3VEKN7V" 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 DA696107A0; Tue, 28 May 2024 02:18:29 +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=1716862710; cv=none; b=qmRAf1ZtU30w/4AGoddWafPQV/B3XxSIFyxPNw8tONjHK4k1bAJNAAjotqlUtYmB2IPGxXxDAYOb0qH60oAkpF49pM5AcRxx7H0EJ/Q1XefI6b7IXTSx62IH8rBAIXRmUo78xQL+tBnTvce3V9a96FZd6MX5ipSCaV7h2OoN4qQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716862710; c=relaxed/simple; bh=vUMgBBUvWuqa6iM8yrXvGGZkqKIAFZID/blyKqHOIQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fAz18JiJ5hRca6hhjg8fx++kaW5kugkfPdnaSvcZcW3FdugwG4QVROADnYG4zGkWPzbDgzCHFLugqVlWirtR42AWJXrT6YOE5jyU1aRuqISM5M4PGcb5tPmx2po6+ilKpygFndF2GOcn9AmK10aqKdnB7oP46rhHKGhonhREY7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G3VEKN7V; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F22FC32782; Tue, 28 May 2024 02:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716862709; bh=vUMgBBUvWuqa6iM8yrXvGGZkqKIAFZID/blyKqHOIQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3VEKN7VQX5etZiaO/fOQzquHd4O9r19fbBA4CTBDPrjcqHK9+UTqjoB/VnlRhVtc QuPbzyfSzrAwFF7XFrDSABkDJkdwZHngLGAc7UhowXPH8/MhTplQUaE5cLJ7fXv9cg +WfsGjpoRn+m7l0u6o8wztL4DWVsST3ykYjSgGkW24SK0upwEk9f4Y3siFeA+kyELX JXanShnY5L17/fQXgaFG88X3Y4DItXjHgB6Fj3CUqFVHURa3HXC/0AsxUDepi1TTr5 ExgfwelAnL7ApkuC0SQATvnjlO4FGlAfHgc+TppFlac9QuXdFeupCqSdAj15/rqXtW Fk0ZQsvphkMNQ== 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.9 2/5] iommu/arm-smmu-v3: Free MSIs in case of ENOMEM Date: Mon, 27 May 2024 22:18:18 -0400 Message-ID: <20240528021823.3904980-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240528021823.3904980-1-sashal@kernel.org> References: <20240528021823.3904980-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.9.2 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 41f93c3ab160d..3afec8714cf28 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3402,7 +3402,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