From bd5b366a50e8c9d0b6ea69ff0c585512fe8cb40d Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Fri, 1 Jun 2018 13:57:27 -0700 Subject: [PATCH] Revert "ANDROID: net: xfrm: check dir value of xfrm_userpolicy_id" This is fixed in a much cleaner way in 7bab09631c2a ("xfrm: policy: check policy direction value"). There is no point to having all of these extra checks when the one will do. This reverts commit 33f17703cceb1258958fb2049fc0b18b6cc8dea6. Bug: 64257838 Change-Id: I9c5862cdf1da9934144d1f785de6d2c3e69d0dd7 Signed-off-by: Nathan Chancellor --- net/xfrm/xfrm_user.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 3badd2c753e1..dbfcfefd6d69 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1753,10 +1753,6 @@ static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb, struct sk_buff *skb; int err; - err = verify_policy_dir(dir); - if (err) - return ERR_PTR(err); - skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) return ERR_PTR(-ENOMEM); @@ -2278,10 +2274,6 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh, struct net *net = sock_net(skb->sk); struct xfrm_encap_tmpl *encap = NULL; - err = verify_policy_dir(pi->dir); - if (err) - return err; - if (attrs[XFRMA_MIGRATE] == NULL) return -EINVAL; @@ -2415,11 +2407,6 @@ static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, { struct net *net = &init_net; struct sk_buff *skb; - int err; - - err = verify_policy_dir(dir); - if (err) - return err; skb = nlmsg_new(xfrm_migrate_msgsize(num_migrate, !!k, !!encap), GFP_ATOMIC); @@ -3089,11 +3076,6 @@ out_free_skb: static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c) { - int err; - - err = verify_policy_dir(dir); - if (err) - return err; switch (c->event) { case XFRM_MSG_NEWPOLICY: -- 2.20.1