nfc: llcp: fix use-after-free in llcp_sock_release()
Subsystems (3)
PATCH 1/1 nfc: llcp: fix use-after-free in llcp_sock_release()
llcp_sock_release() unconditionally unlinks the socket from the local sockets list. However, if the socket is still in connecting state, it is on the connecting list.
Fix this by checking the socket state and unlinking from the correct list.
--- net/nfc/llcp_sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/llcp_sock.c +2 -0
@@ -633,6 +633,8 @@ static int llcp_sock_release(struct socket *sock)if (sock->type ==SOCK_RAW )nfc_llcp_sock_unlink (&local->raw_sockets, sk); +else if (sk->sk_state ==LLCP_CONNECTING ) +nfc_llcp_sock_unlink (&local->connecting_sockets, sk);else nfc_llcp_sock_unlink (&local->sockets, sk);
Signature · 1 line
2.54.0.545.g6539524ca2-goog
Quoted 26 lines · Lee Jones
llcp_sock_release()unconditionally unlinks the socket from the local sockets list. However, if the socket is still in connecting state, it is on the connecting list.Fix this by checking the socket state and unlinking from the correct list.
Signed-off-by Lee Jones <[email protected]>--- net/nfc/llcp_sock.c | 2 ++ 1 file changed, 2 insertions(+)net/nfc/llcp_sock.c +2
-1@@ -633,6 +633,8 @@ static int llcp_sock_release(struct socket *sock)if (sock->type ==SOCK_RAW )nfc_llcp_sock_unlink (&local->raw_sockets, sk); +else if (sk->sk_state ==LLCP_CONNECTING ) +nfc_llcp_sock_unlink (&local->connecting_sockets, sk);else nfc_llcp_sock_unlink (&local->sockets, sk); --
Quoted 2 lines
2.54.0.545.g6539524ca2-goog
Why are you sending this patch a second time?
You forgot to add a Fixes: tag, as requested for all networking patches.
Quoted 26 lines · Eric Dumazet
Quoted 25 lines · Lee Jones
llcp_sock_release()unconditionally unlinks the socket from the local sockets list. However, if the socket is still in connecting state, it is on the connecting list.Fix this by checking the socket state and unlinking from the correct list.
Signed-off-by Lee Jones <[email protected]>--- net/nfc/llcp_sock.c | 2 ++ 1 file changed, 2 insertions(+)net/nfc/llcp_sock.c +2
-0@@ -633,6 +633,8 @@ static int llcp_sock_release(struct socket *sock)if (sock->type ==SOCK_RAW )nfc_llcp_sock_unlink (&local->raw_sockets, sk); +else if (sk->sk_state ==LLCP_CONNECTING ) +nfc_llcp_sock_unlink (&local->connecting_sockets, sk);else nfc_llcp_sock_unlink (&local->sockets, sk);
Quoted 5 lines
Quoted 3 lines
--
2.54.0.545.g6539524ca2-googWhy are you sending this patch a second time?
Because I am a dunce and forgot to clear out my send cache before sending a related but different patch.
Quoted 1 line
You forgot to add a Fixes: tag, as requested for all networking patches.
No problem. Please ignore both of these and I'll follow-up with a coherent set with Fixes: tags applied.
Signature · 1 line
Lee Jones
Quoted 4 lines · Lee Jones
No problem. Please ignore both of these and I'll follow-up with a coherent set with
Fixes:tags applied.
Thanks a lot!