aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-11-22 09:12:16 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-11-26 15:30:19 -0500
commitba6b372cf0af564bdc6c14bf68e078ae34bef222 (patch)
treeb5c2da9fd63da3d145e7a9dd530cb2319a5e576f
parent97d66c47277fc801bc1ee93559a848057181ea55 (diff)
[media] s5p-fimc: Don't use mutex_lock_interruptible() in device release()
Use uninterruptible mutex_lock in the release() file op to make sure all resources are properly freed when a process is being terminated. Returning -ERESTARTSYS has no effect for a terminating process and this caused driver resources not to be released. Not releasing the buffer queue also prevented other drivers to free memory, e.g. in MMAP -> USERPTR scenario. This patch is required for stable kernels v3.6+. Reported-by: Kamil Debski <k.debski@samsung.com> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-capture.c3
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-m2m.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c
index 3fc896b8eeae..891ee873c62b 100644
--- a/drivers/media/platform/s5p-fimc/fimc-capture.c
+++ b/drivers/media/platform/s5p-fimc/fimc-capture.c
@@ -556,8 +556,7 @@ static int fimc_capture_close(struct file *file)
556 556
557 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); 557 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);
558 558
559 if (mutex_lock_interruptible(&fimc->lock)) 559 mutex_lock(&fimc->lock);
560 return -ERESTARTSYS;
561 560
562 if (--fimc->vid_cap.refcnt == 0) { 561 if (--fimc->vid_cap.refcnt == 0) {
563 clear_bit(ST_CAPT_BUSY, &fimc->state); 562 clear_bit(ST_CAPT_BUSY, &fimc->state);
diff --git a/drivers/media/platform/s5p-fimc/fimc-m2m.c b/drivers/media/platform/s5p-fimc/fimc-m2m.c
index 4500e44f6857..62afed3162ea 100644
--- a/drivers/media/platform/s5p-fimc/fimc-m2m.c
+++ b/drivers/media/platform/s5p-fimc/fimc-m2m.c
@@ -718,8 +718,7 @@ static int fimc_m2m_release(struct file *file)
718 dbg("pid: %d, state: 0x%lx, refcnt= %d", 718 dbg("pid: %d, state: 0x%lx, refcnt= %d",
719 task_pid_nr(current), fimc->state, fimc->m2m.refcnt); 719 task_pid_nr(current), fimc->state, fimc->m2m.refcnt);
720 720
721 if (mutex_lock_interruptible(&fimc->lock)) 721 mutex_lock(&fimc->lock);
722 return -ERESTARTSYS;
723 722
724 v4l2_m2m_ctx_release(ctx->m2m_ctx); 723 v4l2_m2m_ctx_release(ctx->m2m_ctx);
725 fimc_ctrls_delete(ctx); 724 fimc_ctrls_delete(ctx);