[PATCH] pvrusb2: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible exit file handle in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index 2cc4d2b..2683373 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -1054,7 +1054,7 @@ static int pvr2_v4l2_open(struct file *file)
pvr2_trace(PVR2_TRACE_STRUCT,
   "Destroying pvr_v4l2_fh id=%p (input mask error)",
   fhp);
-
+   v4l2_fh_exit(>fh);
kfree(fhp);
return ret;
}
@@ -1071,6 +1071,7 @@ static int pvr2_v4l2_open(struct file *file)
pvr2_trace(PVR2_TRACE_STRUCT,
   "Destroying pvr_v4l2_fh id=%p (input map failure)",
   fhp);
+   v4l2_fh_exit(>fh);
kfree(fhp);
return -ENOMEM;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ivtv: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible exit file handle in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/pci/ivtv/ivtv-alsa-pcm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c 
b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c
index a26f980..d0d2c93 100644
--- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c
+++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c
@@ -174,6 +174,7 @@ static int snd_ivtv_pcm_capture_open(struct 
snd_pcm_substream *substream)
/* See if the stream is available */
if (ivtv_claim_stream(, item.type)) {
/* No, it's already in use */
+   v4l2_fh_exit();
snd_ivtv_unlock(itvsc);
return -EBUSY;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] tm6000: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/usb/tm6000/tm6000-video.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c 
b/drivers/media/usb/tm6000/tm6000-video.c
index dee7e7d..b39247a 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1377,8 +1377,11 @@ static int __tm6000_open(struct file *file)
 
/* initialize hardware on analog mode */
rc = tm6000_init_analog_mode(dev);
-   if (rc < 0)
+   if (rc < 0) {
+   v4l2_fh_exit(>fh);
+   kfree(fh);
return rc;
+   }
 
dev->mode = TM6000_MODE_ANALOG;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] tm6000: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/usb/tm6000/tm6000-video.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c 
b/drivers/media/usb/tm6000/tm6000-video.c
index dee7e7d..b39247a 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1377,8 +1377,11 @@ static int __tm6000_open(struct file *file)
 
/* initialize hardware on analog mode */
rc = tm6000_init_analog_mode(dev);
-   if (rc < 0)
+   if (rc < 0) {
+   v4l2_fh_exit(>fh);
+   kfree(fh);
return rc;
+   }
 
dev->mode = TM6000_MODE_ANALOG;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] zoran: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/pci/zoran/zoran_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index d6b631a..13e17a4 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -975,6 +975,7 @@ static int zoran_open(struct file *file)
return 0;
 
 fail_fh:
+   v4l2_fh_exit(>fh);
kfree(fh);
 fail_unlock:
mutex_unlock(>lock);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] vim2m: Clean up file handle in open() error path.

2016-12-19 Thread Santosh Kumar Singh
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/platform/vim2m.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index a98f679..9fd24b8 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -907,6 +907,7 @@ static int vim2m_open(struct file *file)
if (hdl->error) {
rc = hdl->error;
v4l2_ctrl_handler_free(hdl);
+   kfree(ctx);
goto open_unlock;
}
ctx->fh.ctrl_handler = hdl;
@@ -929,6 +930,7 @@ static int vim2m_open(struct file *file)
 
v4l2_ctrl_handler_free(hdl);
+   v4l2_fh_exit(>fh);
kfree(ctx);
goto open_unlock;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] vim2m: Clean up file handle in open() error path.

2016-12-07 Thread Santosh Kumar Singh
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1...@gmail.com>
---
 drivers/media/platform/vim2m.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index a98f679..9fd24b8 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -907,6 +907,7 @@ static int vim2m_open(struct file *file)
if (hdl->error) {
rc = hdl->error;
v4l2_ctrl_handler_free(hdl);
+   kfree(ctx);
goto open_unlock;
}
ctx->fh.ctrl_handler = hdl;
@@ -929,6 +930,7 @@ static int vim2m_open(struct file *file)
 
v4l2_ctrl_handler_free(hdl);
kfree(ctx);
+   v4l2_fh_exit(>fh);
goto open_unlock;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html