aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d7cb16f0df5b..eb8d14389601 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1424,7 +1424,7 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
1424 ret = verify_policy_dir(p->dir); 1424 ret = verify_policy_dir(p->dir);
1425 if (ret) 1425 if (ret)
1426 return ret; 1426 return ret;
1427 if (p->index && ((p->index & XFRM_POLICY_MAX) != p->dir)) 1427 if (p->index && (xfrm_policy_id2dir(p->index) != p->dir))
1428 return -EINVAL; 1428 return -EINVAL;
1429 1429
1430 return 0; 1430 return 0;
@@ -1513,20 +1513,8 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
1513 return -EINVAL; 1513 return -EINVAL;
1514 } 1514 }
1515 1515
1516 switch (ut[i].id.proto) { 1516 if (!xfrm_id_proto_valid(ut[i].id.proto))
1517 case IPPROTO_AH:
1518 case IPPROTO_ESP:
1519 case IPPROTO_COMP:
1520#if IS_ENABLED(CONFIG_IPV6)
1521 case IPPROTO_ROUTING:
1522 case IPPROTO_DSTOPTS:
1523#endif
1524 case IPSEC_PROTO_ANY:
1525 break;
1526 default:
1527 return -EINVAL; 1517 return -EINVAL;
1528 }
1529
1530 } 1518 }
1531 1519
1532 return 0; 1520 return 0;