From: Jason Gunthorpe <jgg@ziepe.ca>
To: Tina Zhang <tina.zhang@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Michael Shavit <mshavit@google.com>,
Vasant Hegde <vasant.hegde@amd.com>,
"Nicolin Chen ^C-cc=iommu @ lists . linux . dev"
<nicolinc@nvidia.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 4/5] iommu: Support mm PASID 1:n with sva domains
Date: Thu, 12 Oct 2023 10:43:10 -0300 [thread overview]
Message-ID: <20231012134310.GI55194@ziepe.ca> (raw)
In-Reply-To: <20231012030112.82270-5-tina.zhang@intel.com>
On Thu, Oct 12, 2023 at 11:01:11AM +0800, Tina Zhang wrote:
> @@ -1188,15 +1193,26 @@ static inline bool tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream
> #ifdef CONFIG_IOMMU_SVA
> static inline void mm_pasid_init(struct mm_struct *mm)
> {
> - mm->pasid = IOMMU_PASID_INVALID;
> + /*
> + * During dup_mm(), a new mm will be memcpy'd from an old one and that makes
> + * the new mm and the old one point to a same iommu_mm instance. When either
> + * one of the two mms gets released, the iommu_mm instance is freed, leaving
> + * the other mm running into a use-after-free/double-free problem. To avoid
> + * the problem, zeroing the iommu_mm pointer of a new mm is needed here.
> + */
> + mm->iommu_mm = NULL;
> }
newlines after all the }, between functions doesn't checkpatch
complain?
IMHO this hunk should be moved to the prior patch.
But it all looks good to me now
Thanks,
Jason
next prev parent reply other threads:[~2023-10-12 13:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 3:01 [PATCH v7 0/5] Share sva domains with all devices bound to a mm Tina Zhang
2023-10-12 3:01 ` [PATCH v7 1/5] iommu/vt-d: Remove mm->pasid in intel_sva_bind_mm() Tina Zhang
2023-10-12 3:01 ` [PATCH v7 2/5] iommu: Add mm_get_enqcmd_pasid() helper function Tina Zhang
2023-10-12 3:01 ` [PATCH v7 3/5] mm: Add structure to keep sva information Tina Zhang
2023-10-12 3:01 ` [PATCH v7 4/5] iommu: Support mm PASID 1:n with sva domains Tina Zhang
2023-10-12 13:43 ` Jason Gunthorpe [this message]
2023-10-13 9:57 ` Zhang, Tina
2023-10-14 0:03 ` Jason Gunthorpe
2023-10-14 1:02 ` Nicolin Chen
2023-10-12 3:01 ` [PATCH v7 5/5] mm: Deprecate pasid field Tina Zhang
2023-10-12 6:14 ` [PATCH v7 0/5] Share sva domains with all devices bound to a mm Nicolin Chen
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=20231012134310.GI55194@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
--cc=tina.zhang@intel.com \
--cc=vasant.hegde@amd.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