Skip to content

Commit

Permalink
qrtr: orphan socket in qrtr_release()
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: 28fb4e5 ("net: qrtr: Expose tunneling endpoint to user space")
Cc: Bjorn Andersson <[email protected]>
Cc: Eric Dumazet <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
congwang authored and davem330 committed Jul 25, 2020
1 parent 657237f commit af9f691
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/qrtr/qrtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,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))
Expand Down

0 comments on commit af9f691

Please sign in to comment.