Re: [PATCH V3 06/14] i3c: master: Fix potential UAF in i3c_device_uevent()
[email protected] Tue, 04 Aug 2026 15:08:34 +0000
| Newsgroups | org.kernel.vger.linux-pci,org.infradead.lists.linux-i3c |
|---|---|
| Message-ID | <[email protected]> |
> i3c_device_uevent() dereferences i3cdev->desc without holding the bus
> normal-use lock. Since the descriptor pointer can be replaced
> concurrently, including when a uevent is generated from sysfs, this can
> result in dereferencing a stale descriptor and lead to a use-after-free.
>=20
> Use i3c_device_get_info() instead, which protects access to the
> descriptor with the normal-use lock.
>=20
> Commit 6cf7b65f7029 ("i3c: Use i3cdev->desc->info instead of calling
> i3c_device_get_info() to avoid deadlock") replaced the accessor with a
> direct descriptor dereference because i3c_device_get_info() would
> recursively acquire bus->lock during device registration.
>=20
> This change depends on "i3c: master: Fix recursive locking during device
> registration", which moves device registration out from under bus->lock
> and removes the possibility of that deadlock. Without that change,
> restoring the i3c_device_get_info() call would reintroduce the deadlock.
>=20
> Fixes: 6cf7b65f7029 ("i3c: Use i3cdev->desc->info instead of calling i3c_=
device_get_info() to avoid deadlock")
> Cc: [email protected] # requires "i3c: master: Fix recursive locking=
during device registration"
> Signed-off-by: Adrian Hunter <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260804133810.1849=
[email protected]?part=3D6