Skip to content

Commit 122f00c

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2017-11-01 1) Fix a memleak when a packet matches a policy without a matching state. 2) Reset the socket cached dst_entry when inserting a socket policy, otherwise the policy might be ignored. From Jonathan Basseri. 3) Fix GSO for a IPsec, GRE tunnel combination. We reset the encapsulation field at the skb too erly, as a result GRE does not segment GSO packets. Fix this by resetting the the encapsulation field right before the transformation where the inner headers get invalid. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 62b0e92 + 73b9fc4 commit 122f00c

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

net/xfrm/xfrm_output.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
105105
if (xfrm_offload(skb)) {
106106
x->type_offload->encap(x, skb);
107107
} else {
108+
/* Inner headers are invalid now. */
109+
skb->encapsulation = 0;
110+
108111
err = x->type->output(x, skb);
109112
if (err == -EINPROGRESS)
110113
goto out;
@@ -208,7 +211,6 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
208211
int err;
209212

210213
secpath_reset(skb);
211-
skb->encapsulation = 0;
212214

213215
if (xfrm_dev_offload_ok(skb, x)) {
214216
struct sec_path *sp;

net/xfrm/xfrm_policy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,6 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
20762076
xdst->num_xfrms = num_xfrms;
20772077
memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols);
20782078

2079-
dst_hold(&xdst->u.dst);
20802079
return xdst;
20812080

20822081
inc_error:

net/xfrm/xfrm_state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,7 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
20692069
if (err >= 0) {
20702070
xfrm_sk_policy_insert(sk, err, pol);
20712071
xfrm_pol_put(pol);
2072+
__sk_dst_reset(sk);
20722073
err = 0;
20732074
}
20742075

0 commit comments

Comments
 (0)