From: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: uvcvideo: Race on dev->state between uvc_disconnect() and uvc_v4l2_open()
Date: Wed, 20 May 2015 17:48:41 +0300 [thread overview]
Message-ID: <555C9EC9.40303@rosalab.ru> (raw)
Hi,
There is a race in uvcvideo module between uvc_disconnect() and
uvc_v4l2_open() on dev->state. Checked and reproduced that with kernel
4.1-rc1.
drivers/media/usb/uvc/uvc_driver.c, uvc_disconnect():
dev->state |= UVC_DEV_DISCONNECTED;
drivers/media/usb/uvc/uvc_v4l2.c, uvc_v4l2_open():
if (stream->dev->state & UVC_DEV_DISCONNECTED)
return -ENODEV;
I checked that the race does happen by introducing a delay in
uvc_disconnect() right before that assignment and armed a hardware
breakpoint to detect the access to stream->dev->state from
uvc_v4l2_open(). When I disconnected the webcam while Google Hangout was
running, the hardware breakpoint triggered several times for that read
in uvc_v4l2_open (uvc_v4l2.c:484). uvc_v4l2_open() was called in the
context of GoogleTalkPlugin processes.
Not sure if the race is intentional but I guess, better to report it
anyway. Nothing has crashed during my (brief) testing yet, but still.
Regards,
Eugene
--
Eugene Shatokhin, ROSA
www.rosalab.com
next reply other threads:[~2015-05-20 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 14:48 Eugene Shatokhin [this message]
2015-05-24 22:32 ` uvcvideo: Race on dev->state between uvc_disconnect() and uvc_v4l2_open() Laurent Pinchart
2015-05-25 6:31 ` Eugene Shatokhin
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=555C9EC9.40303@rosalab.ru \
--to=eugene.shatokhin@rosalab.ru \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@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