Re: [PATCH v3 3/5] staging: iio: isl29018: fixed race condition in in_illuminance_scale_available_show()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/09/16 01:20, Brian Masney wrote:
> in_illuminance_scale_available_show() references the
> isl29018_chip->int_time variable in three places inside a for loop.
> The value of the int_time variable can be updated by the
> isl29018_set_integration_time() function, which is called by the
> isl29018_write_raw() function. isl29018_write_raw() locks a
> mutex specific to this driver when the integration time variable is
> updated.
> 
> Signed-off-by: Brian Masney <masneyb@xxxxxxxxxxxxx>
This one I can get more enthusiastic about.  Nice catch.
I thought about sending this for stable, but as the effect
is minor probably not worth it.

Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/isl29018.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
> index 19f282c..990c6e5 100644
> --- a/drivers/staging/iio/light/isl29018.c
> +++ b/drivers/staging/iio/light/isl29018.c
> @@ -277,10 +277,12 @@ static ssize_t in_illuminance_scale_available_show
>  	unsigned int i;
>  	int len = 0;
>  
> +	mutex_lock(&chip->lock);
>  	for (i = 0; i < ARRAY_SIZE(isl29018_scales[chip->int_time]); ++i)
>  		len += sprintf(buf + len, "%d.%06d ",
>  			       isl29018_scales[chip->int_time][i].scale,
>  			       isl29018_scales[chip->int_time][i].uscale);
> +	mutex_unlock(&chip->lock);
>  
>  	buf[len - 1] = '\n';
>  
> 

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux