summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2016-11-21 10:56:25 -0800
committerDmitry Shmidt <dimitrysh@google.com>2016-11-21 10:56:25 -0800
commit84dc474f3c33c4fbbe42f46876e0dde502e60ad0 (patch)
tree1c60e8369668a67042e47774ae4a389bbfc239b6 /net/ipv4/tcp_ipv4.c
parent40ceb2c69964f8bde97d4ded4306508db16fd365 (diff)
parent4eb9a81002485a7abfa53a334dde5bc10328079f (diff)
Merge tag 'v4.4.34' into android-4.4.y
This is the 4.4.34 stable release Change-Id: Ic90323945584a7173f54595e0482d26fafd10174
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 364ba22ef2ea..b6a48d4a3794 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1533,6 +1533,21 @@ bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
}
EXPORT_SYMBOL(tcp_prequeue);
+int tcp_filter(struct sock *sk, struct sk_buff *skb)
+{
+ struct tcphdr *th = (struct tcphdr *)skb->data;
+ unsigned int eaten = skb->len;
+ int err;
+
+ err = sk_filter_trim_cap(sk, skb, th->doff * 4);
+ if (!err) {
+ eaten -= skb->len;
+ TCP_SKB_CB(skb)->end_seq -= eaten;
+ }
+ return err;
+}
+EXPORT_SYMBOL(tcp_filter);
+
/*
* From tcp_input.c
*/
@@ -1638,8 +1653,10 @@ process:
nf_reset(skb);
- if (sk_filter(sk, skb))
+ if (tcp_filter(sk, skb))
goto discard_and_relse;
+ th = (const struct tcphdr *)skb->data;
+ iph = ip_hdr(skb);
skb->dev = NULL;