Re: [PATCH] tty/n_hdlc: fix __might_sleep warning
On Thu, Jan 10, 2019 at 12:39 PM Tetsuo Handa wrote: > On 2019/01/02 5:28, Paul Fulghum wrote: > > Fix __might_sleep warning in tty/n_hdlc.c read due to copy_to_user call > > while current is TASK_INTERRUPTIBLE. > > This is a false positive since the code path does not depend on current > > state remaining TASK_INTERRUPTIBLE. > > The loop breaks out and sets TASK_RUNNING after calling copy_to_user. > > This patch supresses the warning by setting TASK_RUNNING before calling > > copy_to_user. > > > > [1] > > https://syzkaller.appspot.com/bug?id=17d5de7f1fcab794cb8c40032f893f52de899324 > > > > Signed-off-by: Paul Fulghum > > Reported-by: syzbot > > Cc: Greg Kroah-Hartman > > Cc: Tetsuo Handa > > Cc: Arnd Bergmann > > Cc: Alan Cox This version looks good to me. Acked-by: Arnd Bergmann Arnd
Re: [PATCH] tty/n_hdlc: fix __might_sleep warning
Hello, Greg. We attempted a cleanup but we failed. Thus, will you apply this patch for now? On 2019/01/02 5:28, Paul Fulghum wrote: > Fix __might_sleep warning in tty/n_hdlc.c read due to copy_to_user call while > current is TASK_INTERRUPTIBLE. > This is a false positive since the code path does not depend on current state > remaining TASK_INTERRUPTIBLE. > The loop breaks out and sets TASK_RUNNING after calling copy_to_user. > This patch supresses the warning by setting TASK_RUNNING before calling > copy_to_user. > > [1] > https://syzkaller.appspot.com/bug?id=17d5de7f1fcab794cb8c40032f893f52de899324 > > Signed-off-by: Paul Fulghum > Reported-by: syzbot > Cc: Greg Kroah-Hartman > Cc: Tetsuo Handa > Cc: Arnd Bergmann > Cc: Alan Cox > — > --- a/drivers/tty/n_hdlc.c2018-12-23 15:55:59.0 -0800 > +++ b/drivers/tty/n_hdlc.c2019-01-01 11:44:47.148153954 -0800 > @@ -597,6 +597,7 @@ static ssize_t n_hdlc_tty_read(struct tt > /* too large for caller's buffer */ > ret = -EOVERFLOW; > } else { > + __set_current_state(TASK_RUNNING); > if (copy_to_user(buf, rbuf->buf, rbuf->count)) > ret = -EFAULT; > else
[PATCH] tty/n_hdlc: fix __might_sleep warning
Fix __might_sleep warning in tty/n_hdlc.c read due to copy_to_user call while current is TASK_INTERRUPTIBLE. This is a false positive since the code path does not depend on current state remaining TASK_INTERRUPTIBLE. The loop breaks out and sets TASK_RUNNING after calling copy_to_user. This patch supresses the warning by setting TASK_RUNNING before calling copy_to_user. [1] https://syzkaller.appspot.com/bug?id=17d5de7f1fcab794cb8c40032f893f52de899324 Signed-off-by: Paul Fulghum Reported-by: syzbot Cc: Greg Kroah-Hartman Cc: Tetsuo Handa Cc: Arnd Bergmann Cc: Alan Cox — --- a/drivers/tty/n_hdlc.c 2018-12-23 15:55:59.0 -0800 +++ b/drivers/tty/n_hdlc.c 2019-01-01 11:44:47.148153954 -0800 @@ -597,6 +597,7 @@ static ssize_t n_hdlc_tty_read(struct tt /* too large for caller's buffer */ ret = -EOVERFLOW; } else { + __set_current_state(TASK_RUNNING); if (copy_to_user(buf, rbuf->buf, rbuf->count)) ret = -EFAULT; else