mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] [media] gspca: fix dev_open() error path
Date: Tue, 20 Aug 2013 14:20:20 +0200	[thread overview]
Message-ID: <52135F04.80700@redhat.com> (raw)
In-Reply-To: <1375733797-7002-1-git-send-email-khoroshilov@ispras.ru>

Hi,

Thanks for the patch I've added this to my "gspca" tree, and this
will be included in my next pull-request to Mauro for 3.12

Regards,

Hans

On 08/05/2013 10:16 PM, Alexey Khoroshilov wrote:
> If v4l2_fh_open() fails in dev_open(), gspca_dev->module left locked.
> The patch adds module_put(gspca_dev->module) on this path.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov<khoroshilov@ispras.ru>
> ---
>   drivers/media/usb/gspca/gspca.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
> index b7ae872..048507b 100644
> --- a/drivers/media/usb/gspca/gspca.c
> +++ b/drivers/media/usb/gspca/gspca.c
> @@ -1266,6 +1266,7 @@ static void gspca_release(struct v4l2_device *v4l2_device)
>   static int dev_open(struct file *file)
>   {
>   	struct gspca_dev *gspca_dev = video_drvdata(file);
> +	int ret;
>
>   	PDEBUG(D_STREAM, "[%s] open", current->comm);
>
> @@ -1273,7 +1274,10 @@ static int dev_open(struct file *file)
>   	if (!try_module_get(gspca_dev->module))
>   		return -ENODEV;
>
> -	return v4l2_fh_open(file);
> +	ret = v4l2_fh_open(file);
> +	if (ret)
> +		module_put(gspca_dev->module);
> +	return ret;
>   }
>
>   static int dev_close(struct file *file)
> -- 1.8.1.2
>

      reply	other threads:[~2013-08-20 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 20:16 Alexey Khoroshilov
2013-08-20 12:20 ` Hans de Goede [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=52135F04.80700@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@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

Powered by JetHome