summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-08-05 22:16:37 +0200
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-08-21 10:18:31 +0200
commitb563a0d049143a98411b6a45745186daf443d587 (patch)
treecc88fa5a053f842101d0afb855e630fee1f43a4b /drivers/media
parent[media] radio-si470x-usb: Remove software version check (diff)
downloadlinux-b563a0d049143a98411b6a45745186daf443d587.tar.xz
linux-b563a0d049143a98411b6a45745186daf443d587.zip
[media] gspca: fix dev_open() error path
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> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/gspca/gspca.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index b7ae8721b847..048507b27bb2 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)