summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2020-07-24 09:45:51 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-31 18:39:30 +0200
commitb7d3d6df72a85552a4c6f3a8e5611a7847425314 (patch)
treec4df0f7aed6fcda735e1daaed877c266c41098a6
parent2bf797a8691a806f58e0bb6f2cb80fbbe4b8d6d1 (diff)
downloadlinux-stable-b7d3d6df72a85552a4c6f3a8e5611a7847425314.tar.gz
linux-stable-b7d3d6df72a85552a4c6f3a8e5611a7847425314.tar.bz2
linux-stable-b7d3d6df72a85552a4c6f3a8e5611a7847425314.zip
qrtr: orphan socket in qrtr_release()
[ Upstream commit af9f691f0f5bdd1ade65a7b84927639882d7c3e5 ] We have to detach sock from socket in qrtr_release(), otherwise skb->sk may still reference to this socket when the skb is released in tun->queue, particularly sk->sk_wq still points to &sock->wq, which leads to a UAF. Reported-and-tested-by: syzbot+6720d64f31c081c2f708@syzkaller.appspotmail.com Fixes: 28fb4e59a47d ("net: qrtr: Expose tunneling endpoint to user space") Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/qrtr/qrtr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 14c101e104ce..1ce1e710d025 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -1004,6 +1004,7 @@ static int qrtr_release(struct socket *sock)
sk->sk_state_change(sk);
sock_set_flag(sk, SOCK_DEAD);
+ sock_orphan(sk);
sock->sk = NULL;
if (!sock_flag(sk, SOCK_ZAPPED))