Re: [PATCH] staging: iio: adc: ad7816: Protect sysfs attributes with mutex
From: Dan Carpenter
Date: Sat Sep 19 2026 - 06:45:00 EST
On Sat, Sep 19, 2026 at 11:55:13AM +0300, Abdelnasser Hussein wrote:
> The sysfs store functions (ad7816_store_mode and ad7816_store_channel)
> modify the device state and toggle GPIO pins. If accessed concurrently
> by userspace during an ongoing SPI transfer, this could corrupt the
> SPI transaction.
>
> Add the existing chip->lock guard to these functions to serialize
> access and prevent race conditions.
>
> Suggested-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>
Add a Fixes tag.
regards,
dan carpenter