diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2013-08-05 16:16:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-21 04:18:31 -0400 |
commit | b563a0d049143a98411b6a45745186daf443d587 (patch) | |
tree | cc88fa5a053f842101d0afb855e630fee1f43a4b /drivers/media/usb/gspca | |
parent | 6c94e14e7f802011afc1018fc8529e66f40866b9 (diff) |
[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/usb/gspca')
-rw-r--r-- | drivers/media/usb/gspca/gspca.c | 6 |
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) | |||
1266 | static int dev_open(struct file *file) | 1266 | static int dev_open(struct file *file) |
1267 | { | 1267 | { |
1268 | struct gspca_dev *gspca_dev = video_drvdata(file); | 1268 | struct gspca_dev *gspca_dev = video_drvdata(file); |
1269 | int ret; | ||
1269 | 1270 | ||
1270 | PDEBUG(D_STREAM, "[%s] open", current->comm); | 1271 | PDEBUG(D_STREAM, "[%s] open", current->comm); |
1271 | 1272 | ||
@@ -1273,7 +1274,10 @@ static int dev_open(struct file *file) | |||
1273 | if (!try_module_get(gspca_dev->module)) | 1274 | if (!try_module_get(gspca_dev->module)) |
1274 | return -ENODEV; | 1275 | return -ENODEV; |
1275 | 1276 | ||
1276 | return v4l2_fh_open(file); | 1277 | ret = v4l2_fh_open(file); |
1278 | if (ret) | ||
1279 | module_put(gspca_dev->module); | ||
1280 | return ret; | ||
1277 | } | 1281 | } |
1278 | 1282 | ||
1279 | static int dev_close(struct file *file) | 1283 | static int dev_close(struct file *file) |