summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm
diff options
context:
space:
mode:
authorKristian H. Kristensen <hoegsberg@gmail.com>2018-12-19 17:57:41 +0100
committerRob Clark <robdclark@gmail.com>2019-01-29 16:17:34 +0100
commitcd70d7ade43d7629edab206fedc686e2eb7257b9 (patch)
tree4dbf77a213fd5c0b452ddfa22e88627e023529fa /drivers/gpu/drm/msm
parentMerge tag 'drm-misc-next-2019-01-23' of git://anongit.freedesktop.org/drm/drm... (diff)
downloadlinux-cd70d7ade43d7629edab206fedc686e2eb7257b9.tar.xz
linux-cd70d7ade43d7629edab206fedc686e2eb7257b9.zip
drm/msm: Unblock writer if reader closes file
Prevents deadlock when fifo is full and reader closes file. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r--drivers/gpu/drm/msm/msm_rd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
index 90e9d0a48dc0..d21172933d92 100644
--- a/drivers/gpu/drm/msm/msm_rd.c
+++ b/drivers/gpu/drm/msm/msm_rd.c
@@ -115,7 +115,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz)
char *fptr = &fifo->buf[fifo->head];
int n;
- wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0);
+ wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open);
+ if (!rd->open)
+ return;
/* Note that smp_load_acquire() is not strictly required
* as CIRC_SPACE_TO_END() does not access the tail more
@@ -213,7 +215,10 @@ out:
static int rd_release(struct inode *inode, struct file *file)
{
struct msm_rd_state *rd = inode->i_private;
+
rd->open = false;
+ wake_up_all(&rd->fifo_event);
+
return 0;
}