OSDN Git Service

net/nfc: Avoid stalls when nfc_alloc_send_skb() returned NULL.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Wed, 18 Jul 2018 09:57:27 +0000 (18:57 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jul 2018 12:25:54 +0000 (14:25 +0200)
commitbb68d6a60aad38f2abb0766d930296dca4f370d8
tree40dd5eb84081f228669fb929833107a775b2994c
parentcfc501dfae3931f79b5dd634158d9fd40cb8b099
net/nfc: Avoid stalls when nfc_alloc_send_skb() returned NULL.

commit 3bc53be9db21040b5d2de4d455f023c8c494aa68 upstream.

syzbot is reporting stalls at nfc_llcp_send_ui_frame() [1]. This is
because nfc_llcp_send_ui_frame() is retrying the loop without any delay
when nonblocking nfc_alloc_send_skb() returned NULL.

Since there is no need to use MSG_DONTWAIT if we retry until
sock_alloc_send_pskb() succeeds, let's use blocking call.
Also, in case an unexpected error occurred, let's break the loop
if blocking nfc_alloc_send_skb() failed.

[1] https://syzkaller.appspot.com/bug?id=4a131cc571c3733e0eff6bc673f4e36ae48f19c6

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot <syzbot+d29d18215e477cfbfbdd@syzkaller.appspotmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/llcp_commands.c