lkml.org 
[lkml]   [2019]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 031/135] tun: fix blocking read
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

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

    From: Timur Celik <mail@timurcelik.de>

    [ Upstream commit 71828b2240692cec0e68b8d867bc00e1745e7fae ]

    This patch moves setting of the current state into the loop. Otherwise
    the task may end up in a busy wait loop if none of the break conditions
    are met.

    Signed-off-by: Timur Celik <mail@timurcelik.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/tun.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    --- a/drivers/net/tun.c
    +++ b/drivers/net/tun.c
    @@ -1714,9 +1714,9 @@ static struct sk_buff *tun_ring_recv(str
    }

    add_wait_queue(&tfile->wq.wait, &wait);
    - current->state = TASK_INTERRUPTIBLE;

    while (1) {
    + set_current_state(TASK_INTERRUPTIBLE);
    skb = skb_array_consume(&tfile->tx_array);
    if (skb)
    break;
    @@ -1732,7 +1732,7 @@ static struct sk_buff *tun_ring_recv(str
    schedule();
    }

    - current->state = TASK_RUNNING;
    + set_current_state(TASK_RUNNING);
    remove_wait_queue(&tfile->wq.wait, &wait);

    out:

    \
     
     \ /
      Last update: 2019-03-12 18:17    [W:4.063 / U:0.644 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site