lkml.org 
[lkml]   [2019]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 07/52] drm/msm: Unblock writer if reader closes file
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    [ Upstream commit 99c66bc051e7407fe0bf0607b142ec0be1a1d1dd ]

    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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/gpu/drm/msm/msm_rd.c | 7 ++++++-
    1 file changed, 6 insertions(+), 1 deletion(-)

    diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
    index ec56794ad0399..bdce1c9434c6c 100644
    --- a/drivers/gpu/drm/msm/msm_rd.c
    +++ b/drivers/gpu/drm/msm/msm_rd.c
    @@ -109,7 +109,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
    @@ -207,7 +209,10 @@ static int rd_open(struct inode *inode, struct file *file)
    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;
    }

    --
    2.19.1


    \
     
     \ /
      Last update: 2019-03-04 09:25    [W:4.298 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site