summaryrefslogtreecommitdiff
path: root/net/rose
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2016-11-15 14:43:27 -0700
committerSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>2016-11-15 14:54:51 -0700
commitf36f22a49d4d32ae12a6557ab1a630f5a74da857 (patch)
tree3ee8e2997877754b5841307b01ec5afdabb2ae9e /net/rose
parent1e1700765225e4aa31d076f78c9937bd93509083 (diff)
rose: limit sk_filter trim to payload
Sockets can have a filter program attached that drops or trims incoming packets based on the filter program return value. Rose requires data packets to have at least ROSE_MIN_LEN bytes. It verifies this on arrival in rose_route_frame and unconditionally pulls the bytes in rose_recvmsg. The filter can trim packets to below this value in-between, causing pull to fail, leaving the partial header at the time of skb_copy_datagram_msg. Place a lower bound on the size to which sk_filter may trim packets by introducing sk_filter_trim_cap and call this for rose packets. CRs-Fixed: 1089895 Change-Id: Idc52737bc96097a9220dfe47bb76e94ff1026a05 Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net> Git-commit: f4979fcea7fd36d8e2f556abef86f80e0d5af1ba Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [subashab@codeaurora.org: resolve trivial merge conflicts] Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Diffstat (limited to 'net/rose')
-rw-r--r--net/rose/rose_in.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index 79c4abcfa6b4..fb31d2ea5a81 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -164,7 +164,8 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety
rose_frames_acked(sk, nr);
if (ns == rose->vr) {
rose_start_idletimer(sk);
- if (sock_queue_rcv_skb(sk, skb) == 0) {
+ if (sk_filter_trim_cap(sk, skb, ROSE_MIN_LEN) == 0 &&
+ sock_queue_rcv_skb(sk, skb) == 0) {
rose->vr = (rose->vr + 1) % ROSE_MODULUS;
queued = 1;
} else {