[PATCH 0/2] iio: accel: kxsd9: fix use-after-free and PM leaks

From: Biren Pandya

Date: Fri Jul 03 2026 - 13:24:04 EST


This series fixes a use-after-free during device removal and resolves
multiple runtime PM reference leaks.

Changes in v3:
- Split the fixes into two patches (UAF fix and PM leaks fix) as
requested by Jonathan Cameron.
- remove(): Dropped the early return on PM resume failure. The driver now
makes a best-effort attempt to power down the device unconditionally,
addressing feedback from Andy Shevchenko and Jonathan Cameron.
- read_raw(): Mirrored the -EINVAL reset fix from write_raw() to ensure
symmetric error handling on invalid masks.
- Dropped redundant pm_runtime_mark_last_busy() calls, relying instead
on pm_runtime_put_autosuspend().

Link to v2: https://lore.kernel.org/linux-iio/20260621193036.78549-2-birenpandya@xxxxxxxxx/

---
Biren Pandya (2):
iio: accel: kxsd9: fix use-after-free on remove
iio: accel: kxsd9: fix runtime PM leaks and unchecked returns

drivers/iio/accel/kxsd9.c | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
---
base-commit: 7de6ae9e12207ec146f2f3f1e58d1a99317e88bc
change-id: 20260703-kxsd9-v3-proper-51a1f05c4951

Best regards,
--
Biren Pandya <birenpandya@xxxxxxxxx>