Commit dc776924 authored by Jakub Kicinski's avatar Jakub Kicinski

tcp_ipv6: set the drop_reason in the right place

Looks like the IPv6 version of the patch under Fixes was
a copy/paste of the IPv4 but hit the wrong spot.
It is tcp_v6_rcv() which uses drop_reason as a boolean, and
needs to be protected against reason == 0 before calling free.
tcp_v6_do_rcv() has a pretty straightforward flow.

The resulting warning looks like this:
  WARNING: CPU: 1 PID: 0 at net/core/skbuff.c:775
  Call Trace:
    tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1767)
    ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:438)
    ip6_input_finish (include/linux/rcupdate.h:726)
    ip6_input (include/linux/netfilter.h:307)

Fixes: f8319dfd ("net: tcp: reset 'drop_reason' to NOT_SPCIFIED in tcp_v{4,6}_rcv()")
Tested-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/20220520021347.2270207-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b6d26144
...@@ -1509,7 +1509,6 @@ int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -1509,7 +1509,6 @@ int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
discard: discard:
if (opt_skb) if (opt_skb)
__kfree_skb(opt_skb); __kfree_skb(opt_skb);
SKB_DR_OR(reason, NOT_SPECIFIED);
kfree_skb_reason(skb, reason); kfree_skb_reason(skb, reason);
return 0; return 0;
csum_err: csum_err:
...@@ -1763,6 +1762,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) ...@@ -1763,6 +1762,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
} }
discard_it: discard_it:
SKB_DR_OR(drop_reason, NOT_SPECIFIED);
kfree_skb_reason(skb, drop_reason); kfree_skb_reason(skb, drop_reason);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment