[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BL1PR11MB5271F7BD6FF2E99D6C8EC5688C08A@BL1PR11MB5271.namprd11.prod.outlook.com>
Date: Fri, 12 Sep 2025 09:34:11 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Nicolin Chen <nicolinc@...dia.com>, "joro@...tes.org" <joro@...tes.org>,
"jgg@...dia.com" <jgg@...dia.com>, "bhelgaas@...gle.com"
<bhelgaas@...gle.com>
CC: "suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"will@...nel.org" <will@...nel.org>, "robin.murphy@....com"
<robin.murphy@....com>, "sven@...nel.org" <sven@...nel.org>, "j@...nau.net"
<j@...nau.net>, "alyssa@...enzweig.io" <alyssa@...enzweig.io>,
"neal@...pa.dev" <neal@...pa.dev>, "robin.clark@....qualcomm.com"
<robin.clark@....qualcomm.com>, "m.szyprowski@...sung.com"
<m.szyprowski@...sung.com>, "krzk@...nel.org" <krzk@...nel.org>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>, "dwmw2@...radead.org"
<dwmw2@...radead.org>, "baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
"yong.wu@...iatek.com" <yong.wu@...iatek.com>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>, "tjeznach@...osinc.com"
<tjeznach@...osinc.com>, "paul.walmsley@...ive.com"
<paul.walmsley@...ive.com>, "palmer@...belt.com" <palmer@...belt.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>, "alex@...ti.fr"
<alex@...ti.fr>, "heiko@...ech.de" <heiko@...ech.de>,
"schnelle@...ux.ibm.com" <schnelle@...ux.ibm.com>, "mjrosato@...ux.ibm.com"
<mjrosato@...ux.ibm.com>, "gerald.schaefer@...ux.ibm.com"
<gerald.schaefer@...ux.ibm.com>, "orsonzhai@...il.com" <orsonzhai@...il.com>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
"zhang.lyra@...il.com" <zhang.lyra@...il.com>, "wens@...e.org"
<wens@...e.org>, "jernej.skrabec@...il.com" <jernej.skrabec@...il.com>,
"samuel@...lland.org" <samuel@...lland.org>, "jean-philippe@...aro.org"
<jean-philippe@...aro.org>, "rafael@...nel.org" <rafael@...nel.org>,
"lenb@...nel.org" <lenb@...nel.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
"cwabbott0@...il.com" <cwabbott0@...il.com>, "quic_pbrahma@...cinc.com"
<quic_pbrahma@...cinc.com>, "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"asahi@...ts.linux.dev" <asahi@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-arm-msm@...r.kernel.org"
<linux-arm-msm@...r.kernel.org>, "linux-samsung-soc@...r.kernel.org"
<linux-samsung-soc@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>, "linux-riscv@...ts.infradead.org"
<linux-riscv@...ts.infradead.org>, "linux-rockchip@...ts.infradead.org"
<linux-rockchip@...ts.infradead.org>, "linux-s390@...r.kernel.org"
<linux-s390@...r.kernel.org>, "linux-sunxi@...ts.linux.dev"
<linux-sunxi@...ts.linux.dev>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "virtualization@...ts.linux.dev"
<virtualization@...ts.linux.dev>, "linux-acpi@...r.kernel.org"
<linux-acpi@...r.kernel.org>, "linux-pci@...r.kernel.org"
<linux-pci@...r.kernel.org>, "patches@...ts.linux.dev"
<patches@...ts.linux.dev>, "Sethi, Vikram" <vsethi@...dia.com>,
"helgaas@...nel.org" <helgaas@...nel.org>, "etzhao1900@...il.com"
<etzhao1900@...il.com>
Subject: RE: [PATCH v4 2/7] iommu: Lock group->mutex in
iommu_deferred_attach()
> From: Nicolin Chen <nicolinc@...dia.com>
> Sent: Monday, September 1, 2025 7:32 AM
>
> The iommu_deferred_attach() function invokes __iommu_attach_device()
> while
> not holding the group->mutex, like other __iommu_attach_device() callers.
>
> Though there is no pratical bug being triggered so far, it would be better
> to apply the same locking to this __iommu_attach_device(), since the
> IOMMU
> drivers nowaday are more aware of the group->mutex -- some of them use
> the
> iommu_group_mutex_assert() function that could be potentially in the path
> of an attach_dev callback function invoked by the __iommu_attach_device().
>
> The iommu_deferred_attach() will soon need to verify a new flag stored in
> the struct group_device. To iterate the gdev list, the group->mutex should
> be held for this matter too.
>
> So, grab the mutex to guard __iommu_attach_device() like other callers.
>
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists