aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-06-01 13:25:41 -0400
committerDavid S. Miller <davem@davemloft.net>2018-06-01 13:25:41 -0400
commitccfde6e27d9566bee596d41a2cc6f158af8595d5 (patch)
treeafc718c79fd75ed746ea4796a045125d1aac4827
parenta95691bc54af1ac4b12c354f91e9cabf1cb068df (diff)
parent38369f54d97dd7dc50c73a2797bfeb53c2e87d2d (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2018-05-31 1) Avoid possible overflow of the offset variable in _decode_session6(), this fixes an infinite lookp there. From Eric Dumazet. 2) We may use an error pointer in the error path of xfrm_bundle_create(). Fix this by returning this pointer directly to the caller. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/xfrm6_policy.c2
-rw-r--r--net/xfrm/xfrm_policy.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 416fe67271a9..86dba282a147 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -126,7 +126,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
126 struct flowi6 *fl6 = &fl->u.ip6; 126 struct flowi6 *fl6 = &fl->u.ip6;
127 int onlyproto = 0; 127 int onlyproto = 0;
128 const struct ipv6hdr *hdr = ipv6_hdr(skb); 128 const struct ipv6hdr *hdr = ipv6_hdr(skb);
129 u16 offset = sizeof(*hdr); 129 u32 offset = sizeof(*hdr);
130 struct ipv6_opt_hdr *exthdr; 130 struct ipv6_opt_hdr *exthdr;
131 const unsigned char *nh = skb_network_header(skb); 131 const unsigned char *nh = skb_network_header(skb);
132 u16 nhoff = IP6CB(skb)->nhoff; 132 u16 nhoff = IP6CB(skb)->nhoff;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 40b54cc64243..5f48251c1319 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1658,7 +1658,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
1658 trailer_len -= xdst_prev->u.dst.xfrm->props.trailer_len; 1658 trailer_len -= xdst_prev->u.dst.xfrm->props.trailer_len;
1659 } 1659 }
1660 1660
1661out:
1662 return &xdst0->u.dst; 1661 return &xdst0->u.dst;
1663 1662
1664put_states: 1663put_states:
@@ -1667,8 +1666,8 @@ put_states:
1667free_dst: 1666free_dst:
1668 if (xdst0) 1667 if (xdst0)
1669 dst_release_immediate(&xdst0->u.dst); 1668 dst_release_immediate(&xdst0->u.dst);
1670 xdst0 = ERR_PTR(err); 1669
1671 goto out; 1670 return ERR_PTR(err);
1672} 1671}
1673 1672
1674static int xfrm_expand_policies(const struct flowi *fl, u16 family, 1673static int xfrm_expand_policies(const struct flowi *fl, u16 family,