From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: Re: [PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq()
Date: Sun, 28 May 2017 15:46:48 +0100 [thread overview]
Message-ID: <20170528154648.4186501c@kernel.org> (raw)
In-Reply-To: <38c5952c-8c92-9d97-73cd-06fd0d74aaf3@metafoo.de>
On Sun, 28 May 2017 11:47:04 +0200
Lars-Peter Clausen <lars@metafoo.de> wrote:
> 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>
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
>
>
> > ---
> > 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;
> > }
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2017-05-28 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 22:53 [PATCH] staging: iio: ad7152: Fix deadlock in ad7152_write_raw_samp_freq() Alexey Khoroshilov
2017-05-28 9:47 ` Lars-Peter Clausen
2017-05-28 14:46 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170528154648.4186501c@kernel.org \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=khoroshilov@ispras.ru \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=ldv-project@linuxtesting.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.