Skip to content

Commit f3f1f5d

Browse files
committed
xfrm: validate new SA's prefixlen using SA family when sel.family is unset
jira LE-2177 cve CVE-2024-50142 Rebuild_History Non-Buildable kernel-5.14.0-503.19.1.el9_5 commit-author Sabrina Dubroca <[email protected]> commit 3f0ab59 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-503.19.1.el9_5/3f0ab59e.failed This expands the validation introduced in commit 07bf790 ("xfrm: Validate address prefix lengths in the xfrm selector.") syzbot created an SA with usersa.sel.family = AF_UNSPEC usersa.sel.prefixlen_s = 128 usersa.family = AF_INET Because of the AF_UNSPEC selector, verify_newsa_info doesn't put limits on prefixlen_{s,d}. But then copy_from_user_state sets x->sel.family to usersa.family (AF_INET). Do the same conversion in verify_newsa_info before validating prefixlen_{s,d}, since that's how prefixlen is going to be used later on. Reported-by: [email protected] Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: Steffen Klassert <[email protected]> (cherry picked from commit 3f0ab59) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # net/xfrm/xfrm_user.c
1 parent b040fea commit f3f1f5d

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
xfrm: validate new SA's prefixlen using SA family when sel.family is unset
2+
3+
jira LE-2177
4+
cve CVE-2024-50142
5+
Rebuild_History Non-Buildable kernel-5.14.0-503.19.1.el9_5
6+
commit-author Sabrina Dubroca <[email protected]>
7+
commit 3f0ab59e6537c6a8f9e1b355b48f9c05a76e8563
8+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
9+
Will be included in final tarball splat. Ref for failed cherry-pick at:
10+
ciq/ciq_backports/kernel-5.14.0-503.19.1.el9_5/3f0ab59e.failed
11+
12+
This expands the validation introduced in commit 07bf7908950a ("xfrm:
13+
Validate address prefix lengths in the xfrm selector.")
14+
15+
syzbot created an SA with
16+
usersa.sel.family = AF_UNSPEC
17+
usersa.sel.prefixlen_s = 128
18+
usersa.family = AF_INET
19+
20+
Because of the AF_UNSPEC selector, verify_newsa_info doesn't put
21+
limits on prefixlen_{s,d}. But then copy_from_user_state sets
22+
x->sel.family to usersa.family (AF_INET). Do the same conversion in
23+
verify_newsa_info before validating prefixlen_{s,d}, since that's how
24+
prefixlen is going to be used later on.
25+
26+
Reported-by: [email protected]
27+
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
28+
Signed-off-by: Sabrina Dubroca <[email protected]>
29+
Signed-off-by: Steffen Klassert <[email protected]>
30+
(cherry picked from commit 3f0ab59e6537c6a8f9e1b355b48f9c05a76e8563)
31+
Signed-off-by: Jonathan Maple <[email protected]>
32+
33+
# Conflicts:
34+
# net/xfrm/xfrm_user.c
35+
diff --cc net/xfrm/xfrm_user.c
36+
index a9f7d204e6df,8d06a37adbd9..000000000000
37+
--- a/net/xfrm/xfrm_user.c
38+
+++ b/net/xfrm/xfrm_user.c
39+
@@@ -176,6 -200,8 +176,11 @@@ static int verify_newsa_info(struct xfr
40+
struct netlink_ext_ack *extack)
41+
{
42+
int err;
43+
++<<<<<<< HEAD
44+
++=======
45+
+ u8 sa_dir = attrs[XFRMA_SA_DIR] ? nla_get_u8(attrs[XFRMA_SA_DIR]) : 0;
46+
+ u16 family = p->sel.family;
47+
++>>>>>>> 3f0ab59e6537 (xfrm: validate new SA's prefixlen using SA family when sel.family is unset)
48+
49+
err = -EINVAL;
50+
switch (p->family) {
51+
* Unmerged path net/xfrm/xfrm_user.c

0 commit comments

Comments
 (0)