[PATCH] bdisp: Clean up file handle in open() error path.
The File handle is not yet added in the vdev list.So no need to call v4l2_fh_del(>fh)if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/sti/bdisp/bdisp-v4l2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index 45f82b5..fbf302f 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -632,8 +632,8 @@ static int bdisp_open(struct file *file) error_ctrls: bdisp_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); bdisp_hw_free_nodes(ctx); mem_ctx: -- 1.7.9.5 -- 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] exynos-gsc: Clean up file handle in open() error path.
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos-gsc/gsc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 9f03b79..5ea97c1 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -664,8 +664,8 @@ static int gsc_m2m_open(struct file *file) error_ctrls: gsc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] exynos4-is: Clean up file handle in open() error path.
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos4-is/fimc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c index 6028e4f..d8724fe 100644 --- a/drivers/media/platform/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/exynos4-is/fimc-m2m.c @@ -663,8 +663,8 @@ static int fimc_m2m_open(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error_c: fimc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] Platform: Sti: Bdisp: Clean up file handle in open() error path.
The File handle is not yet added in the vdev list.So no need to call v4l2_fh_del(>fh)if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/sti/bdisp/bdisp-v4l2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index 45f82b5..fbf302f 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -632,8 +632,8 @@ static int bdisp_open(struct file *file) error_ctrls: bdisp_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); bdisp_hw_free_nodes(ctx); mem_ctx: -- 1.7.9.5 -- 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] V4l: omap4iss: Clean up file handle in open() and release().
Both functions initialize the file handle with v4l2_fh_init() and thus need to call clean up with v4l2_fh_exit() as appropriate. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/omap4iss/iss_video.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index c16927a..077c9f8 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -1141,6 +1141,7 @@ static int iss_video_open(struct file *file) done: if (ret < 0) { v4l2_fh_del(>vfh); + v4l2_fh_exit(>vfh); kfree(handle); } @@ -1162,6 +1163,7 @@ static int iss_video_release(struct file *file) vb2_queue_release(>queue); v4l2_fh_del(vfh); + v4l2_fh_exit(vfh); kfree(handle); file->private_data = NULL; -- 1.7.9.5 -- 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] Platform: vsp1: Clean up file handle in open() error path.
v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition before returing from the function. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/vsp1/vsp1_video.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index d351b9c..cc58163 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -1044,6 +1044,7 @@ static int vsp1_video_open(struct file *file) ret = vsp1_device_get(video->vsp1); if (ret < 0) { v4l2_fh_del(vfh); + v4l2_fh_exit(vfh); kfree(vfh); } -- 1.7.9.5 -- 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] V4l: omap3isp: Clean up file handle in open() and release().
Both functions initialize the file handle with v4l2_fh_init() and thus need to call clean up with v4l2_fh_exit() as appropriate. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/omap3isp/ispvideo.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 7354469..9f966e8 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c @@ -1350,6 +1350,7 @@ static int isp_video_open(struct file *file) done: if (ret < 0) { v4l2_fh_del(>vfh); + v4l2_fh_exit(>vfh); kfree(handle); } @@ -1373,6 +1374,7 @@ static int isp_video_release(struct file *file) /* Release the file handle. */ v4l2_fh_del(vfh); + v4l2_fh_exit(vfh); kfree(handle); file->private_data = NULL; -- 1.7.9.5 -- 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] Platform: Exynos-gsc: Clean up file handle in open() error path.
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos-gsc/gsc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 9f03b79..5ea97c1 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -664,8 +664,8 @@ static int gsc_m2m_open(struct file *file) error_ctrls: gsc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] Platform: Exynos4-is: Clean up file handle in open() error path.
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos4-is/fimc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c index 6028e4f..d8724fe 100644 --- a/drivers/media/platform/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/exynos4-is/fimc-m2m.c @@ -663,8 +663,8 @@ static int fimc_m2m_open(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error_c: fimc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] Media: platform: vsp1: - Do not forget to call
v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition before returing from the function. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/vsp1/vsp1_video.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index d351b9c..cc58163 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -1044,6 +1044,7 @@ static int vsp1_video_open(struct file *file) ret = vsp1_device_get(video->vsp1); if (ret < 0) { v4l2_fh_del(vfh); + v4l2_fh_exit(vfh); kfree(vfh); } -- 1.7.9.5 -- 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] Staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization fails.
Fix to avoid possible memory leak if the decoder initialization got failed.Free the allocated memory for file handle object before return in case decoder initialization fails. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/davinci_vpfe/vpfe_video.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 8be9f85..4215445 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -423,6 +423,9 @@ static int vpfe_open(struct file *file) /* If decoder is not initialized. initialize it */ if (!video->initialized && vpfe_update_pipe_state(video)) { mutex_unlock(>lock); + v4l2_fh_del(>vfh); + v4l2_fh_exit(>vfh); + kfree(handle); return -ENODEV; } /* Increment device users counter */ -- 1.7.9.5 -- 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] Media: Platform: Exynos-gsc: - Fix for error handling
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos-gsc/gsc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 9f03b79..5ea97c1 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -664,8 +664,8 @@ static int gsc_m2m_open(struct file *file) error_ctrls: gsc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] Staging: media: platform: davinci: - Fix for memory leak
Fix to avoid possible memory leak if the decoder initialization got failed. Free the allocated memory for file handle object before return in case decoder initialization fails. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/davinci/vpfe_capture.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 6efb2f1..188b333 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -526,6 +526,8 @@ static int vpfe_open(struct file *file) if (!vpfe_dev->initialized) { if (vpfe_initialize_device(vpfe_dev)) { mutex_unlock(_dev->lock); + v4l2_fh_exit(>fh); + kfree(fh); return -ENODEV; } } -- 1.7.9.5 -- 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] Staging: Media: Omap4iss: Do not forget to call
v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition before returing from the function. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/omap4iss/iss_video.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index c16927a..c46d14d 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -1141,6 +1141,7 @@ static int iss_video_open(struct file *file) done: if (ret < 0) { v4l2_fh_del(>vfh); + v4l2_fh_exit(>vfh); kfree(handle); } -- 1.7.9.5 -- 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] Media: Platform: Sti: Bdisp: - Fix for error handling
The File handle is not yet added in the vdev list.So no need to call v4l2_fh_del(>fh)if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/sti/bdisp/bdisp-v4l2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index 45f82b5..fbf302f 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -632,8 +632,8 @@ static int bdisp_open(struct file *file) error_ctrls: bdisp_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); bdisp_hw_free_nodes(ctx); mem_ctx: -- 1.7.9.5 -- 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] Media: Platform: Omap3isp: Do not forget to call
v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition before returing from the function. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/omap3isp/ispvideo.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 7354469..2822e2f 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c @@ -1350,6 +1350,7 @@ static int isp_video_open(struct file *file) done: if (ret < 0) { v4l2_fh_del(>vfh); + v4l2_fh_exit(>vfh); kfree(handle); } -- 1.7.9.5 -- 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] Media: Platform: Exynos4-is: - Fix for error handling
The File handle is not yet added in the vfd list.So no need to call v4l2_fh_del(>fh) if it fails to create control. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/media/platform/exynos4-is/fimc-m2m.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c index 6028e4f..d8724fe 100644 --- a/drivers/media/platform/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/exynos4-is/fimc-m2m.c @@ -663,8 +663,8 @@ static int fimc_m2m_open(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error_c: fimc_ctrls_delete(ctx); -error_fh: v4l2_fh_del(>fh); +error_fh: v4l2_fh_exit(>fh); kfree(ctx); unlock: -- 1.7.9.5 -- 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] Staging: media: davinci_vpfe: - Fix for memory leak if
From: "Shailendra Verma" <shailendr...@samsung.com> Fix to avoid possible memory leak if the decoder initialization got failed.Free the allocated memory for file handle object before return in case decoder initialization fails. Signed-off-by: Shailendra Verma <shailendra.capric...@gmail.com> --- drivers/staging/media/davinci_vpfe/vpfe_video.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 8be9f85..80c2e25 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -423,6 +423,7 @@ static int vpfe_open(struct file *file) /* If decoder is not initialized. initialize it */ if (!video->initialized && vpfe_update_pipe_state(video)) { mutex_unlock(>lock); + kfree(handle); return -ENODEV; } /* Increment device users counter */ -- 1.7.9.5 -- 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] Staging: Media: Lirc - Improvement in code readability
From: "Shailendra Verma" <shailendr...@samsung.com> There is no need to call kfree() if memdup_user() fails, as no memory was allocated and the error in the error-valued pointer should be returned. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/lirc/lirc_imon.c |5 ++--- drivers/staging/media/lirc/lirc_sasem.c |5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 198a805..610d38c 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -408,9 +408,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, data_buf = memdup_user(buf, n_bytes); if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; + mutex_unlock(>ctx_lock); + return PTR_ERR(data_buf); } memcpy(context->tx.data_buf, data_buf, n_bytes); diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 4678ae1..4fd810b 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -384,9 +384,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, data_buf = memdup_user(buf, n_bytes); if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; + mutex_unlock(>ctx_lock); + return PTR_ERR(data_buf); } memcpy(context->tx.data_buf, data_buf, n_bytes); -- 1.7.9.5 -- 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 2/2] Staging: Media: Lirc - Improvement in code readability
From: "Shailendra Verma" <shailendr...@samsung.com> There is no need to call kfree() if memdup_user() fails, as no memory was allocated and the error in the error-valued pointer should be returned. Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/lirc/lirc_imon.c |5 ++--- drivers/staging/media/lirc/lirc_sasem.c |5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 198a805..610d38c 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -408,9 +408,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, data_buf = memdup_user(buf, n_bytes); if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; + mutex_unlock(>ctx_lock); + return PTR_ERR(data_buf); } memcpy(context->tx.data_buf, data_buf, n_bytes); diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 4678ae1..4fd810b 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -384,9 +384,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, data_buf = memdup_user(buf, n_bytes); if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; + mutex_unlock(>ctx_lock); + return PTR_ERR(data_buf); } memcpy(context->tx.data_buf, data_buf, n_bytes); -- 1.7.9.5 -- 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
Staging: Media: Lirc - Fix possible ERR_PTR() dereferencing.
This is of course wrong to call kfree() if memdup_user() fails, no memory was allocated and the error in the error-valued pointer should be returned. Reviewed-by: Ravikant Sharma <ravikant...@samsung.com> Signed-off-by: Shailendra Verma <shailendr...@samsung.com> --- drivers/staging/media/lirc/lirc_imon.c | 7 ++- drivers/staging/media/lirc/lirc_sasem.c | 7 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 534b810..c21591b 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -409,11 +409,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, } data_buf = memdup_user(buf, n_bytes); - if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; - } + if (IS_ERR(data_buf)) + return PTR_ERR(data_buf); memcpy(context->tx.data_buf, data_buf, n_bytes); diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index f2dca69..ba1ee86 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -387,11 +387,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, } data_buf = memdup_user(buf, n_bytes); - if (IS_ERR(data_buf)) { - retval = PTR_ERR(data_buf); - data_buf = NULL; - goto exit; - } + if (IS_ERR(data_buf)) + return PTR_ERR(data_buf); memcpy(context->tx.data_buf, data_buf, n_bytes); -- 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