qrtr: orphan socket in qrtr_release()
Subsystems (3)
PATCH v2 1/1 qrtr: orphan socket in qrtr_release()
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.
--- net/qrtr/qrtr.c | 1 + 1 file changed, 1 insertion(+)
net/qrtr/qrtr.c +1 -0
@@ -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 ))
Signature · 1 line
2.27.0
Quoted 21 lines · Cong Wang
We have to detach sock from socket in
qrtr_release(), otherwiseskb->skmay still reference to this socket when the skb is released intun->queue, particularlysk->sk_wqstill points to&sock->wq, which leads to a UAF.Reported-and-tested-by [email protected]Fixes 28fb4e59a47d ("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]>--- net/qrtr/qrtr.c | 1 + 1 file changed, 1 insertion(+)net/qrtr/qrtr.c +0
-0
net/qrtr/qrtr.c static int qrtr_release(struct socket *sock) · line 1186
Quoted 7 lines
net/qrtr/qrtr.c +1
-0@@ -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 ))
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Fri, 24 Jul 2020 09:45:51 -0700
Quoted 11 lines
We have to detach sock from socket in
qrtr_release(), otherwiseskb->skmay still reference to this socket when the skb is released intun->queue, particularlysk->sk_wqstill points to&sock->wq, which leads to a UAF.Reported-and-tested-by [email protected]Fixes 28fb4e59a47d ("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]>
Applied and queued up for -stable, thanks.