Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b563a0d0 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 6c94e14e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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)