Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1652081
| From | Lars-Peter Clausen <lars@metafoo.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq() |
| Date | 2017-05-28 11:50 +0200 |
| Message-ID | <tM2ZH-by-11@gated-at.bofh.it> (permalink) |
| References | <tLyIj-4Vw-57@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 05/27/2017 12:53 AM, Alexey Khoroshilov wrote:
> ad7152_write_raw_samp_freq() is called by ad7152_write_raw() with
> chip->state_lock held. So, there is unavoidable deadlock when
> ad7152_write_raw_samp_freq() locks the mutex itself.
>
> The patch removes unneeded locking.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Looks good, thanks.
Fixes: 6572389bcc11 ("staging: iio: cdc: ad7152: Implement
IIO_CHAN_INFO_SAMP_FREQ attribute")
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
> drivers/staging/iio/cdc/ad7152.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
> index dc6ecd824365..ff10d1f0a7e4 100644
> --- a/drivers/staging/iio/cdc/ad7152.c
> +++ b/drivers/staging/iio/cdc/ad7152.c
> @@ -231,16 +231,12 @@ static int ad7152_write_raw_samp_freq(struct device *dev, int val)
> if (i >= ARRAY_SIZE(ad7152_filter_rate_table))
> i = ARRAY_SIZE(ad7152_filter_rate_table) - 1;
>
> - mutex_lock(&chip->state_lock);
> ret = i2c_smbus_write_byte_data(chip->client,
> AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
> - if (ret < 0) {
> - mutex_unlock(&chip->state_lock);
> + if (ret < 0)
> return ret;
> - }
>
> chip->filter_rate_setup = i;
> - mutex_unlock(&chip->state_lock);
>
> return ret;
> }
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq() Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-05-27 03:30 +0200
Re: [PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq() Lars-Peter Clausen <lars@metafoo.de> - 2017-05-28 11:50 +0200
Re: [PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq() Jonathan Cameron <jic23@kernel.org> - 2017-05-28 16:50 +0200
csiph-web