* [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads
@ 2026-08-14 9:07 Arka Mondal
2026-08-14 9:07 ` [PATCH 2/3] iio: imu: adis16400: " Arka Mondal
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Arka Mondal @ 2026-08-14 9:07 UTC (permalink / raw)
To: nuno.sa, Michael.Hennerich, jic23
Cc: dlechner, andy, venkat.prashanth2498, rohitsarkar5398, linux,
linux-iio, linux-kernel, Arka Mondal
The firmware_revision and firmware_date file operations are open coded
and never call debugfs_file_get(), which debugfs_create_file_unsafe()
requires. debugfs_remove_recursive() therefore does not wait for a read
in progress, and unbind frees the iio_dev underneath it.
Use debugfs_create_file() instead.
Fixes: 9bf94f836e32 ("imu:adis16480: fix debugfs_simple_attr.cocci warnings")
Signed-off-by: Arka Mondal <arkamondalofficial@gmail.com>
---
Compile tested only; no relevant hardware available.
drivers/iio/imu/adis16480.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index e009f3824768..254b7ff25b66 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -309,9 +309,9 @@ static void adis16480_debugfs_init(struct iio_dev *indio_dev)
if (!IS_ENABLED(CONFIG_DEBUG_FS))
return;
- debugfs_create_file_unsafe("firmware_revision", 0400,
+ debugfs_create_file("firmware_revision", 0400,
d, adis16480, &adis16480_firmware_revision_fops);
- debugfs_create_file_unsafe("firmware_date", 0400,
+ debugfs_create_file("firmware_date", 0400,
d, adis16480, &adis16480_firmware_date_fops);
debugfs_create_file_unsafe("serial_number", 0400,
d, adis16480, &adis16480_serial_number_fops);
--
2.55.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/3] iio: imu: adis16400: fix unprotected debugfs reads
2026-08-14 9:07 [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads Arka Mondal
@ 2026-08-14 9:07 ` Arka Mondal
2026-08-15 8:42 ` Andy Shevchenko
2026-08-14 9:07 ` [PATCH 3/3] iio: gyro: adis16136: " Arka Mondal
2026-08-15 8:47 ` [PATCH 1/3] iio: imu: adis16480: " Andy Shevchenko
2 siblings, 1 reply; 9+ messages in thread
From: Arka Mondal @ 2026-08-14 9:07 UTC (permalink / raw)
To: nuno.sa, Michael.Hennerich, jic23
Cc: dlechner, andy, venkat.prashanth2498, rohitsarkar5398, linux,
linux-iio, linux-kernel, Arka Mondal
The serial_number file operations are open coded and never call
debugfs_file_get(), which debugfs_create_file_unsafe() requires.
debugfs_remove_recursive() therefore does not wait for a read in
progress, and unbind frees the iio_dev underneath it.
Use debugfs_create_file() instead.
Fixes: ae1d37a9bb4b ("iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE")
Signed-off-by: Arka Mondal <arkamondalofficial@gmail.com>
---
Compile tested only; no relevant hardware available.
drivers/iio/imu/adis16400.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
index 36323ad149e0..7e85c1b8dc16 100644
--- a/drivers/iio/imu/adis16400.c
+++ b/drivers/iio/imu/adis16400.c
@@ -280,7 +280,7 @@ static void adis16400_debugfs_init(struct iio_dev *indio_dev)
return;
if (st->variant->flags & ADIS16400_HAS_SERIAL_NUMBER)
- debugfs_create_file_unsafe("serial_number", 0400,
+ debugfs_create_file("serial_number", 0400,
d, st, &adis16400_serial_number_fops);
if (st->variant->flags & ADIS16400_HAS_PROD_ID)
debugfs_create_file_unsafe("product_id", 0400,
--
2.55.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/3] iio: imu: adis16400: fix unprotected debugfs reads
2026-08-14 9:07 ` [PATCH 2/3] iio: imu: adis16400: " Arka Mondal
@ 2026-08-15 8:42 ` Andy Shevchenko
2026-08-22 21:37 ` Jonathan Cameron
0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2026-08-15 8:42 UTC (permalink / raw)
To: Arka Mondal
Cc: nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Fri, Aug 14, 2026 at 06:07:27PM +0900, Arka Mondal wrote:
> The serial_number file operations are open coded and never call
> debugfs_file_get(), which debugfs_create_file_unsafe() requires.
> debugfs_remove_recursive() therefore does not wait for a read in
> progress, and unbind frees the iio_dev underneath it.
>
> Use debugfs_create_file() instead.
Have you read the code? Have you read the commit message of the "culprit"
commit?
NAK. Please, revisit all your patches and be careful next time.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] iio: imu: adis16400: fix unprotected debugfs reads
2026-08-15 8:42 ` Andy Shevchenko
@ 2026-08-22 21:37 ` Jonathan Cameron
2026-08-24 8:29 ` Andy Shevchenko
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2026-08-22 21:37 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Arka Mondal, nuno.sa, Michael.Hennerich, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Sat, 15 Aug 2026 11:42:30 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Fri, Aug 14, 2026 at 06:07:27PM +0900, Arka Mondal wrote:
> > The serial_number file operations are open coded and never call
> > debugfs_file_get(), which debugfs_create_file_unsafe() requires.
> > debugfs_remove_recursive() therefore does not wait for a read in
> > progress, and unbind frees the iio_dev underneath it.
> >
> > Use debugfs_create_file() instead.
>
> Have you read the code? Have you read the commit message of the "culprit"
> commit?
>
> NAK. Please, revisit all your patches and be careful next time.
>
FWIW it is curious that the original patch didn't touch the serial number
declaration whilst touching the other two. Superficially that looks
like an omission we missed in review.
Jonathan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] iio: imu: adis16400: fix unprotected debugfs reads
2026-08-22 21:37 ` Jonathan Cameron
@ 2026-08-24 8:29 ` Andy Shevchenko
0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2026-08-24 8:29 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Arka Mondal, nuno.sa, Michael.Hennerich, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Sat, Aug 22, 2026 at 10:37:53PM +0100, Jonathan Cameron wrote:
> On Sat, 15 Aug 2026 11:42:30 +0300
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
>
> > On Fri, Aug 14, 2026 at 06:07:27PM +0900, Arka Mondal wrote:
> > > The serial_number file operations are open coded and never call
> > > debugfs_file_get(), which debugfs_create_file_unsafe() requires.
> > > debugfs_remove_recursive() therefore does not wait for a read in
> > > progress, and unbind frees the iio_dev underneath it.
> > >
> > > Use debugfs_create_file() instead.
> >
> > Have you read the code? Have you read the commit message of the "culprit"
> > commit?
> >
> > NAK. Please, revisit all your patches and be careful next time.
> >
> FWIW it is curious that the original patch didn't touch the serial number
> declaration whilst touching the other two. Superficially that looks
> like an omission we missed in review.
I see, yes, it some strange case of missing piece during review.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] iio: gyro: adis16136: fix unprotected debugfs reads
2026-08-14 9:07 [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads Arka Mondal
2026-08-14 9:07 ` [PATCH 2/3] iio: imu: adis16400: " Arka Mondal
@ 2026-08-14 9:07 ` Arka Mondal
2026-08-15 8:49 ` Andy Shevchenko
2026-08-15 8:47 ` [PATCH 1/3] iio: imu: adis16480: " Andy Shevchenko
2 siblings, 1 reply; 9+ messages in thread
From: Arka Mondal @ 2026-08-14 9:07 UTC (permalink / raw)
To: nuno.sa, Michael.Hennerich, jic23
Cc: dlechner, andy, venkat.prashanth2498, rohitsarkar5398, linux,
linux-iio, linux-kernel, Arka Mondal
The serial_number file operations are open coded and never call
debugfs_file_get(), which debugfs_create_file_unsafe() requires.
debugfs_remove_recursive() therefore does not wait for a read in
progress, and unbind frees the iio_dev underneath it.
Use debugfs_create_file() instead.
Fixes: 9aaea09b4cbd ("gyro:adis16136: fix debugfs_simple_attr.cocci warnings")
Signed-off-by: Arka Mondal <arkamondalofficial@gmail.com>
---
Compile tested only; no relevant hardware available.
drivers/iio/gyro/adis16136.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index 369c7428e1ef..adcf54b67a28 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -145,7 +145,7 @@ static int adis16136_debugfs_init(struct iio_dev *indio_dev)
struct adis16136 *adis16136 = iio_priv(indio_dev);
struct dentry *d = iio_get_debugfs_dentry(indio_dev);
- debugfs_create_file_unsafe("serial_number", 0400,
+ debugfs_create_file("serial_number", 0400,
d, adis16136, &adis16136_serial_fops);
debugfs_create_file_unsafe("product_id", 0400,
d, adis16136, &adis16136_product_id_fops);
--
2.55.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] iio: gyro: adis16136: fix unprotected debugfs reads
2026-08-14 9:07 ` [PATCH 3/3] iio: gyro: adis16136: " Arka Mondal
@ 2026-08-15 8:49 ` Andy Shevchenko
2026-08-22 21:39 ` Jonathan Cameron
0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2026-08-15 8:49 UTC (permalink / raw)
To: Arka Mondal
Cc: nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Fri, Aug 14, 2026 at 06:07:28PM +0900, Arka Mondal wrote:
> The serial_number file operations are open coded and never call
> debugfs_file_get(), which debugfs_create_file_unsafe() requires.
> debugfs_remove_recursive() therefore does not wait for a read in
> progress, and unbind frees the iio_dev underneath it.
>
> Use debugfs_create_file() instead.
Same question as per patch 1.
But if Jonathan likes as is
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] iio: gyro: adis16136: fix unprotected debugfs reads
2026-08-15 8:49 ` Andy Shevchenko
@ 2026-08-22 21:39 ` Jonathan Cameron
0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2026-08-22 21:39 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Arka Mondal, nuno.sa, Michael.Hennerich, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Sat, 15 Aug 2026 11:49:12 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Fri, Aug 14, 2026 at 06:07:28PM +0900, Arka Mondal wrote:
> > The serial_number file operations are open coded and never call
> > debugfs_file_get(), which debugfs_create_file_unsafe() requires.
> > debugfs_remove_recursive() therefore does not wait for a read in
> > progress, and unbind frees the iio_dev underneath it.
> >
> > Use debugfs_create_file() instead.
>
> Same question as per patch 1.
> But if Jonathan likes as is
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
>
I haven't looked into the tradeoffs fo the two possible solutions,
so would like v2 to have a cover letter and for that to state why
one was chosen over the other.
Thanks
Jonathan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads
2026-08-14 9:07 [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads Arka Mondal
2026-08-14 9:07 ` [PATCH 2/3] iio: imu: adis16400: " Arka Mondal
2026-08-14 9:07 ` [PATCH 3/3] iio: gyro: adis16136: " Arka Mondal
@ 2026-08-15 8:47 ` Andy Shevchenko
2 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2026-08-15 8:47 UTC (permalink / raw)
To: Arka Mondal
Cc: nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
venkat.prashanth2498, rohitsarkar5398, linux, linux-iio,
linux-kernel
On Fri, Aug 14, 2026 at 06:07:26PM +0900, Arka Mondal wrote:
> The firmware_revision and firmware_date file operations are open coded
> and never call debugfs_file_get(), which debugfs_create_file_unsafe()
> requires. debugfs_remove_recursive() therefore does not wait for a read
> in progress, and unbind frees the iio_dev underneath it.
>
> Use debugfs_create_file() instead.
This one looks correct, but would it be possible to switch to use
DEFINE_DEBUGFS_ATTRIBUTE() instead?
In case Jonathan wants to apply this
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
...
Also whenever send a series, add cover letter to it. Your patch preparing
should be like
git format-patch --cover-letter --base ... -v <n> ...
where <n> is patch series version number.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-08-24 8:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 9:07 [PATCH 1/3] iio: imu: adis16480: fix unprotected debugfs reads Arka Mondal
2026-08-14 9:07 ` [PATCH 2/3] iio: imu: adis16400: " Arka Mondal
2026-08-15 8:42 ` Andy Shevchenko
2026-08-22 21:37 ` Jonathan Cameron
2026-08-24 8:29 ` Andy Shevchenko
2026-08-14 9:07 ` [PATCH 3/3] iio: gyro: adis16136: " Arka Mondal
2026-08-15 8:49 ` Andy Shevchenko
2026-08-22 21:39 ` Jonathan Cameron
2026-08-15 8:47 ` [PATCH 1/3] iio: imu: adis16480: " Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox