From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-usb@vger.kernel.org, tom.leiming@gmail.com,
linux-media@vger.kernel.org
Subject: Re: [PATCH] uvc: fix race of open and suspend in error case
Date: Thu, 10 Jan 2013 11:48:23 +0100 [thread overview]
Message-ID: <1668668.TJ5Durkkcc@avalon> (raw)
In-Reply-To: <1357812295-21174-1-git-send-email-oliver@neukum.org>
Hi Oliver,
Thank you for the patch.
On Thursday 10 January 2013 11:04:55 Oliver Neukum wrote:
> Ming Lei reported:
> IMO, there is a minor fault in the error handling path of
> uvc_status_start() inside uvc_v4l2_open(), and the 'users' count
> should have been decreased before usb_autopm_put_interface().
> In theory, the warning can be triggered when the device is
> opened just between usb_autopm_put_interface() and
> atomic_dec(&stream->dev->users).
> The fix is trivial.
>
> Signed-off-by:Oliver Neukum <oneukum@suse.de>
I've slightly modified the commit message with more details about the warning:
uvcvideo: Fix race of open and suspend in error case
Ming Lei reported:
IMO, there is a minor fault in the error handling path of
uvc_status_start() inside uvc_v4l2_open(), and the 'users' count should
have been decreased before usb_autopm_put_interface(). In theory, a [URB
resubmission] warning can be triggered when the device is opened just
between usb_autopm_put_interface() and atomic_dec(&stream->dev->users).
The fix is trivial.
Reported-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
The patch is in my tree, I'll push it to v3.9.
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> b/drivers/media/usb/uvc/uvc_v4l2.c index f2ee8c6..74937b7 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -501,8 +501,8 @@ static int uvc_v4l2_open(struct file *file)
> if (atomic_inc_return(&stream->dev->users) == 1) {
> ret = uvc_status_start(stream->dev);
> if (ret < 0) {
> - usb_autopm_put_interface(stream->dev->intf);
> atomic_dec(&stream->dev->users);
> + usb_autopm_put_interface(stream->dev->intf);
> kfree(handle);
> return ret;
> }
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2013-01-10 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 10:04 [PATCH] uvc: fix race of open and suspend in error case Oliver Neukum
2013-01-10 10:48 ` Laurent Pinchart [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=1668668.TJ5Durkkcc@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=tom.leiming@gmail.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;
as well as URLs for NNTP newsgroup(s).