From: Jason Gunthorpe <jgg@nvidia.com>
To: Michael Shavit <mshavit@google.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
iommu@lists.linux.dev, Nicolin Chen <nicolinc@nvidia.com>
Subject: Re: [bug report] iommu/arm-smmu-v3: Refactor write_ctx_desc
Date: Fri, 2 Feb 2024 09:35:57 -0400 [thread overview]
Message-ID: <20240202133557.GR1455070@nvidia.com> (raw)
In-Reply-To: <CAKHBV24oM7JpenJfGXymcxkRdW=49dVWS72oCuTxt-FEguSueA@mail.gmail.com>
On Fri, Feb 02, 2024 at 09:33:14PM +0900, Michael Shavit wrote:
> Jason, should we consider moving arm_smmu_get_cd_ptr() further up the
> call-stack as a standalone patch to remediate this report in the
> shorter term? It won't make this static checker happy, but should at
> least resolve any true positives.
Moving is the right answer, but I suspect it is too hard for rc. Lets
leave it to my series that already exists.
Instead we can preallocate:
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
@@ -588,6 +588,11 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
{
int ret = 0;
struct mm_struct *mm = domain->mm;
+ struct arm_smmu_master *master = dev_iommu_priv_get(dev);
+
+ /* Preallocate the required leafs outside locks */
+ if (!arm_smmu_get_cd_ptr(master, id))
+ return -ENOMEM;
mutex_lock(&sva_lock);
ret = __arm_smmu_sva_bind(dev, mm);
It won't silence Dan's warning warning but it will correct the bug for
now.
I'll send a patch
Jason
next prev parent reply other threads:[~2024-02-02 13:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 12:18 [bug report] iommu/arm-smmu-v3: Refactor write_ctx_desc Dan Carpenter
2024-02-02 12:33 ` Michael Shavit
2024-02-02 13:35 ` Jason Gunthorpe [this message]
2024-02-02 14:45 ` Dan Carpenter
2024-02-02 14:59 ` Jason Gunthorpe
2024-02-05 10:56 ` Dan Carpenter
2024-02-03 8:00 ` Michael Shavit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240202133557.GR1455070@nvidia.com \
--to=jgg@nvidia.com \
--cc=dan.carpenter@linaro.org \
--cc=iommu@lists.linux.dev \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox