diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2016-07-25 18:06:12 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-26 06:40:33 +0200 |
commit | ba66bbe5480a012108958a71cff88b23dce84956 (patch) | |
tree | 1896547dcd8bc441534f7ce2ca3b21f4911ec920 /net/ipv6 | |
parent | caif-hsi: Remove deprecated create_singlethread_workqueue (diff) | |
download | linux-ba66bbe5480a012108958a71cff88b23dce84956.tar.xz linux-ba66bbe5480a012108958a71cff88b23dce84956.zip |
udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb
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>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/udp.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index ad5292be17bd..81e2f98b958d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -618,9 +618,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) 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); |