public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Jarod Wilson <jarod@wilsonet.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	devel@driverdev.osuosl.org, ldv-project@linuxtesting.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] [media] lirc_imon: do not leave imon_probe() with mutex held
Date: Mon, 16 Nov 2015 18:04:35 +0300	[thread overview]
Message-ID: <20151116150434.GJ18797@mwanda> (raw)
In-Reply-To: <1447525076-12068-1-git-send-email-khoroshilov@ispras.ru>

On Sat, Nov 14, 2015 at 09:17:56PM +0300, Alexey Khoroshilov wrote:
> Commit af8a819a2513 ("[media] lirc_imon: simplify error handling code")
> lost mutex_unlock(&context->ctx_lock), so imon_probe() exits with
> the context->ctx_lock mutex acquired.
> 
> The patch adds mutex_unlock(&context->ctx_lock) back.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: af8a819a2513 ("[media] lirc_imon: simplify error handling code")

Hm...  This patch is from June and it totally breaks the driver.  It's
dissapointing that no one reported this bug.

> ---
>  drivers/staging/media/lirc/lirc_imon.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
> index 534b8103ae80..ff1926ca1f96 100644
> --- a/drivers/staging/media/lirc/lirc_imon.c
> +++ b/drivers/staging/media/lirc/lirc_imon.c
> @@ -885,12 +885,14 @@ static int imon_probe(struct usb_interface *interface,
>  		vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum);
>  
>  	/* Everything went fine. Just unlock and return retval (with is 0) */
> +	mutex_unlock(&context->ctx_lock);
>  	goto driver_unlock;
>  
>  unregister_lirc:
>  	lirc_unregister_driver(driver->minor);
>  
>  free_tx_urb:
> +	mutex_unlock(&context->ctx_lock);
>  	usb_free_urb(tx_urb);

Now the label name doesn't make sense.  Also this unlock isn't needed
because we are just going to free context anyway.

regards,
dan carpenter


      reply	other threads:[~2015-11-16 15:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14 18:17 [PATCH] [media] lirc_imon: do not leave imon_probe() with mutex held Alexey Khoroshilov
2015-11-16 15:04 ` Dan Carpenter [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=20151116150434.GJ18797@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarod@wilsonet.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox