Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: correct check user owned socket
Browse files Browse the repository at this point in the history
correct the check for user owned socket in TCP handling of routing
redirect.
this issue could lead to a race condition and a kernel crash, see
45caeaa ("dccp/tcp: fix routing redirect race")

Fixes: e56ce50 ("Merge tag 'v4.11' into mptcp_trunk")
Reported-by: Christoph Paasch <[email protected]>
Reviewed-by: Matthieu Baerts <[email protected]>
Signed-off-by: Tim Froidcoeur <[email protected]>
Acked-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
(cherry picked from commit 041e84d)
Signed-off-by: Matthieu Baerts <[email protected]>
(cherry picked from commit 7d7555f)
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
TimFroidcoeur authored and matttbe committed Aug 31, 2022
1 parent 071adf4 commit 2964098
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)

switch (type) {
case ICMP_REDIRECT:
if (!sock_owned_by_user(sk))
if (!sock_owned_by_user(meta_sk))
do_redirect(icmp_skb, sk);
goto out;
case ICMP_SOURCE_QUENCH:
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
np = inet6_sk(sk);

if (type == NDISC_REDIRECT) {
if (!sock_owned_by_user(sk)) {
if (!sock_owned_by_user(meta_sk)) {
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);

if (dst)
Expand Down

0 comments on commit 2964098

Please sign in to comment.