All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb" has been added to the 4.7-stable tree
@ 2016-08-12  7:36 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-08-12  7:36 UTC (permalink / raw)
  To: daniel, davem, gregkh, willemb; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb

to the 4.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     udp-use-sk_filter_trim_cap-for-udp-6-_queue_rcv_skb.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Fri Aug 12 09:34:44 CEST 2016
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Mon, 25 Jul 2016 18:06:12 +0200
Subject: udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb

From: Daniel Borkmann <daniel@iogearbox.net>

[ Upstream commit ba66bbe5480a012108958a71cff88b23dce84956 ]

After a612769774a3 ("udp: prevent bugcheck if filter truncates packet
too much"), there followed various other fixes for similar cases such
as f4979fcea7fd ("rose: limit sk_filter trim to payload").

Latter introduced a new helper sk_filter_trim_cap(), where we can pass
the trim limit directly to the socket filter handling. Make use of it
here as well with sizeof(struct udphdr) as lower cap limit and drop the
extra skb->len test in UDP's input path.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/udp.c |    4 +---
 net/ipv6/udp.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1581,9 +1581,7 @@ int udp_queue_rcv_skb(struct sock *sk, s
 	    udp_lib_checksum_complete(skb))
 			goto csum_error;
 
-	if (sk_filter(sk, skb))
-		goto drop;
-	if (unlikely(skb->len < sizeof(struct udphdr)))
+	if (sk_filter_trim_cap(sk, skb, sizeof(struct udphdr)))
 		goto drop;
 
 	udp_csum_pull_header(skb);
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -618,9 +618,7 @@ int udpv6_queue_rcv_skb(struct sock *sk,
 	    udp_lib_checksum_complete(skb))
 		goto csum_error;
 
-	if (sk_filter(sk, skb))
-		goto drop;
-	if (unlikely(skb->len < sizeof(struct udphdr)))
+	if (sk_filter_trim_cap(sk, skb, sizeof(struct udphdr)))
 		goto drop;
 
 	udp_csum_pull_header(skb);


Patches currently in stable-queue which might be from daniel@iogearbox.net are

queue-4.7/udp-use-sk_filter_trim_cap-for-udp-6-_queue_rcv_skb.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-12  7:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12  7:36 Patch "udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb" has been added to the 4.7-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.