]> git.baikalelectronics.ru Git - kernel.git/commit
udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 25 Jul 2016 16:06:12 +0000 (18:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Jul 2016 04:40:33 +0000 (21:40 -0700)
commitf60f77fa32780d6dd43f0806003bdef770b96b5a
tree1896547dcd8bc441534f7ce2ca3b21f4911ec920
parentf2c43e8d5a8684970cfbb5d546e4c5af03a886ea
udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb

After b9ce4a78686d ("udp: prevent bugcheck if filter truncates packet
too much"), there followed various other fixes for similar cases such
as c98e58bf49dd ("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>
net/ipv4/udp.c
net/ipv6/udp.c