From: Chris Rankin <rankincj@yahoo.com>
To: linux-media@vger.kernel.org
Subject: Locking problem between em28xx and em28xx-dvb modules - Part 2
Date: Tue, 16 Aug 2011 22:50:03 +0100 [thread overview]
Message-ID: <4E4AE60B.4050903@yahoo.com> (raw)
Hi,
I've been looking deeper into the em28xx and em28xx-dvb modules, and I'm
concerned that there are some races and resource leaks inherent in the current code:
a) Shouldn't em28xx_init_extension() and em28xx_add_into_devlist() be unified
into a single function? Otherwise, consider someone plugging a DVB adapter into
a host when the em28xx-dvb module is not yet loaded:
- em28xx_init_dev() adds new device to list.
- em28xx-dvb module registers itself, and initialises every device in the list
(including our new one).
- em28xx_init_dev() iterates over the list of extensions (including em28xx-dvb)
with the new device.
At this point, dvb_init() has been called twice for our new device, resulting in
a leaked struct em28xx_dvb.
b) When em28xx_init_dev() returns something != 0, em28xx_usb_probe() frees the
struct em28xx and exits without calling usb_put_dev().
c) There are many ways that em28xx_init_dev() can return something != 0, and not
all of them release the V4L2 device or I2C device.
Am I understanding this code correctly, please? I can obviously extend my patch
accordingly - it is currently running without any obvious problems, but I only
have one DVB adapter and none that uses the ALSA extension.
Cheers,
Chris
reply other threads:[~2011-08-16 21:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4E4AE60B.4050903@yahoo.com \
--to=rankincj@yahoo.com \
--cc=linux-media@vger.kernel.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.