Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee0b6f48 authored by David S. Miller's avatar David S. Miller
Browse files


Steffen Klassert says:

====================
pull request (net): ipsec 2018-10-01

1) Validate address prefix lengths in the xfrm selector,
   otherwise we may hit undefined behaviour in the
   address matching functions if the prefix is too
   big for the given address family.

2) Fix skb leak on local message size errors.
   From Thadeu Lima de Souza Cascardo.

3) We currently reset the transport header back to the network
   header after a transport mode transformation is applied. This
   leads to an incorrect transport header when multiple transport
   mode transformations are applied. Reset the transport header
   only after all transformations are already applied to fix this.
   From Sowmini Varadhan.

4) We only support one offloaded xfrm, so reset crypto_done after
   the first transformation in xfrm_input(). Otherwise we may call
   the wrong input method for subsequent transformations.
   From Sowmini Varadhan.

5) Fix NULL pointer dereference when skb_dst_force clears the dst_entry.
   skb_dst_force does not really force a dst refcount anymore, it might
   clear it instead. xfrm code did not expect this, add a check to not
   dereference skb_dst() if it was cleared by skb_dst_force.

6) Validate xfrm template mode, otherwise we can get a stack-out-of-bounds
   read in xfrm_state_find. From Sean Tranchetti.

Please pull or let me know if there are problems.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1ad98e9d 32bf94fb
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)


	if (xo && (xo->flags & XFRM_GRO)) {
	if (xo && (xo->flags & XFRM_GRO)) {
		skb_mac_header_rebuild(skb);
		skb_mac_header_rebuild(skb);
		skb_reset_transport_header(skb);
		return 0;
		return 0;
	}
	}


+1 −3
Original line number Original line Diff line number Diff line
@@ -46,7 +46,6 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
{
{
	int ihl = skb->data - skb_transport_header(skb);
	int ihl = skb->data - skb_transport_header(skb);
	struct xfrm_offload *xo = xfrm_offload(skb);


	if (skb->transport_header != skb->network_header) {
	if (skb->transport_header != skb->network_header) {
		memmove(skb_transport_header(skb),
		memmove(skb_transport_header(skb),
@@ -54,7 +53,6 @@ static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
		skb->network_header = skb->transport_header;
		skb->network_header = skb->transport_header;
	}
	}
	ip_hdr(skb)->tot_len = htons(skb->len + ihl);
	ip_hdr(skb)->tot_len = htons(skb->len + ihl);
	if (!xo || !(xo->flags & XFRM_GRO))
	skb_reset_transport_header(skb);
	skb_reset_transport_header(skb);
	return 0;
	return 0;
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)


	if (xo && (xo->flags & XFRM_GRO)) {
	if (xo && (xo->flags & XFRM_GRO)) {
		skb_mac_header_rebuild(skb);
		skb_mac_header_rebuild(skb);
		skb_reset_transport_header(skb);
		return -1;
		return -1;
	}
	}


+1 −3
Original line number Original line Diff line number Diff line
@@ -51,7 +51,6 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
{
{
	int ihl = skb->data - skb_transport_header(skb);
	int ihl = skb->data - skb_transport_header(skb);
	struct xfrm_offload *xo = xfrm_offload(skb);


	if (skb->transport_header != skb->network_header) {
	if (skb->transport_header != skb->network_header) {
		memmove(skb_transport_header(skb),
		memmove(skb_transport_header(skb),
@@ -60,7 +59,6 @@ static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
	}
	}
	ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
	ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
					   sizeof(struct ipv6hdr));
					   sizeof(struct ipv6hdr));
	if (!xo || !(xo->flags & XFRM_GRO))
	skb_reset_transport_header(skb);
	skb_reset_transport_header(skb);
	return 0;
	return 0;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -170,9 +170,11 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)


	if (toobig && xfrm6_local_dontfrag(skb)) {
	if (toobig && xfrm6_local_dontfrag(skb)) {
		xfrm6_local_rxpmtu(skb, mtu);
		xfrm6_local_rxpmtu(skb, mtu);
		kfree_skb(skb);
		return -EMSGSIZE;
		return -EMSGSIZE;
	} else if (!skb->ignore_df && toobig && skb->sk) {
	} else if (!skb->ignore_df && toobig && skb->sk) {
		xfrm_local_error(skb, mtu);
		xfrm_local_error(skb, mtu);
		kfree_skb(skb);
		return -EMSGSIZE;
		return -EMSGSIZE;
	}
	}


Loading