Commit 1eacc87
Sabrina Dubroca
tcp: drop secpath at the same time as we currently drop dst
JIRA: https://issues.redhat.com/browse/RHEL-69649
JIRA: https://issues.redhat.com/browse/RHEL-83224
CVE: CVE-2025-21864
commit 9b6412e
Author: Sabrina Dubroca <sd@queasysnail.net>
Date: Mon Feb 17 11:23:35 2025 +0100
tcp: drop secpath at the same time as we currently drop dst
Xiumei reported hitting the WARN in xfrm6_tunnel_net_exit while
running tests that boil down to:
- create a pair of netns
- run a basic TCP test over ipcomp6
- delete the pair of netns
The xfrm_state found on spi_byaddr was not deleted at the time we
delete the netns, because we still have a reference on it. This
lingering reference comes from a secpath (which holds a ref on the
xfrm_state), which is still attached to an skb. This skb is not
leaked, it ends up on sk_receive_queue and then gets defer-free'd by
skb_attempt_defer_free.
The problem happens when we defer freeing an skb (push it on one CPU's
defer_list), and don't flush that list before the netns is deleted. In
that case, we still have a reference on the xfrm_state that we don't
expect at this point.
We already drop the skb's dst in the TCP receive path when it's no
longer needed, so let's also drop the secpath. At this point,
tcp_filter has already called into the LSM hooks that may require the
secpath, so it should not be needed anymore. However, in some of those
places, the MPTCP extension has just been attached to the skb, so we
cannot simply drop all extensions.
Fixes: 68822bd ("net: generalize skb freeing deferral to per-cpu lists")
Reported-by: Xiumei Mu <xmu@redhat.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/5055ba8f8f72bdcb602faa299faca73c280b7735.1739743613.git.sd@queasysnail.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sabrina Dubroca <sdubroca@redhat.com>1 parent ef2902a commit 1eacc87
File tree
4 files changed
+21
-7
lines changed- include/net
- net/ipv4
4 files changed
+21
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
640 | 641 | | |
641 | 642 | | |
642 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
643 | 657 | | |
644 | 658 | | |
645 | 659 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4803 | 4803 | | |
4804 | 4804 | | |
4805 | 4805 | | |
4806 | | - | |
| 4806 | + | |
4807 | 4807 | | |
4808 | 4808 | | |
4809 | 4809 | | |
| |||
4994 | 4994 | | |
4995 | 4995 | | |
4996 | 4996 | | |
4997 | | - | |
| 4997 | + | |
4998 | 4998 | | |
4999 | 4999 | | |
5000 | 5000 | | |
| |||
5077 | 5077 | | |
5078 | 5078 | | |
5079 | 5079 | | |
5080 | | - | |
| 5080 | + | |
5081 | 5081 | | |
5082 | 5082 | | |
5083 | 5083 | | |
| |||
5988 | 5988 | | |
5989 | 5989 | | |
5990 | 5990 | | |
5991 | | - | |
| 5991 | + | |
5992 | 5992 | | |
5993 | 5993 | | |
5994 | 5994 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1773 | 1773 | | |
1774 | 1774 | | |
1775 | 1775 | | |
1776 | | - | |
| 1776 | + | |
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
| |||
0 commit comments