All of lore.kernel.org
 help / color / mirror / Atom feed
From: Malcolm Priestley <tvboxspy@gmail.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [media] lmedm04: Do not unlock mutex if mutex_lock_interruptible failed
Date: Sat, 16 Apr 2011 17:37:23 +0100	[thread overview]
Message-ID: <1302971843.3068.9.camel@localhost> (raw)
In-Reply-To: <1302912068.2177.16.camel@localhost>

On Sat, 2011-04-16 at 01:01 +0100, Malcolm Priestley wrote:
> On Sat, 2011-04-16 at 00:40 +0400, Alexey Khoroshilov wrote:
> > There are a couple of places where mutex_unlock() is called even 
> > if mutex_lock_interruptible() failed. The patch fixes the issue.
> > 
> > Found by Linux Driver Verification project (linuxtesting.org).
> > 
> > Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> > ---
> >  drivers/media/dvb/dvb-usb/lmedm04.c |   12 +++++++-----
> >  1 files changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
> > index f2db012..40907df 100644
> > --- a/drivers/media/dvb/dvb-usb/lmedm04.c
> > +++ b/drivers/media/dvb/dvb-usb/lmedm04.c
> > @@ -591,9 +591,10 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
> >  	else {
> >  		deb_info(1, "STM Steam Off");
> >  		/* mutex is here only to avoid collision with I2C */
> > -		ret = mutex_lock_interruptible(&adap->dev->i2c_mutex);
> > +		if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
> > +			return -EAGAIN;
> >  
> > -		ret |= lme2510_usb_talk(adap->dev, clear_reg_3,
> > +		ret = lme2510_usb_talk(adap->dev, clear_reg_3,
> >  				sizeof(clear_reg_3), rbuf, rlen);
> >  		st->stream_on = 0;
> >  		st->i2c_talk_onoff = 1;
> 
> Unfortunately dvb-usb does not provide -EAGAIN on streaming_ctrl
> stopping and returns 0 instead.
> 

I have added a patch to dvb-usb to return device errors to the demuxer

This patch may now be applied.

Tested by: Malcolm Priestley <tvboxspy@gmail.com>

Regards

Malcolm



      reply	other threads:[~2011-04-16 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 20:40 [PATCH] [media] lmedm04: Do not unlock mutex if mutex_lock_interruptible failed Alexey Khoroshilov
2011-04-16  0:01 ` Malcolm Priestley
2011-04-16 16:37   ` Malcolm Priestley [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=1302971843.3068.9.camel@localhost \
    --to=tvboxspy@gmail.com \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /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.