aboutsummaryrefslogtreecommitdiff
path: root/net/core/filter.c
diff options
context:
space:
mode:
authorBrian Wood <brian.j.wood@intel.com>2017-02-27 16:58:40 -0800
committerBrian Wood <brian.j.wood@intel.com>2017-02-28 15:35:14 -0800
commitb7147432cf0d58533bd21fe594d0be1d153f91a6 (patch)
treeaec042cd9c91432c09285381c5d5af85072975c9 /net/core/filter.c
parentce7cfcfa1251122880d34fae7259309b64a78434 (diff)
parentec55e7c2bf49a426b6f8204505bd267c77554d37 (diff)
downloadedison-v3.10-n-iot-preview-4.tar.gz
Merge remote-tracking branch 'remotes/origin/brillo/linux-3.10.y' into Brillo-20170221-3.10_kernelandroid-n-iot-preview-4n-iot-preview-4
Conflicts: crypto/blkcipher.c drivers/platform/x86/intel_scu_ipcutil.c drivers/usb/gadget/u_ether.c fs/ext4/extents.c net/bluetooth/sco.c net/wireless/scan.c Change-Id: Iaea6d22acb3da6b0477d71cf546858d35295e3d2
Diffstat (limited to 'net/core/filter.c')
-rw-r--r--net/core/filter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index c6c18d8a2d8..65f2a65b533 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -67,9 +67,10 @@ static inline void *load_pointer(const struct sk_buff *skb, int k,
}
/**
- * sk_filter - run a packet through a socket filter
+ * sk_filter_trim_cap - run a packet through a socket filter
* @sk: sock associated with &sk_buff
* @skb: buffer to filter
+ * @cap: limit on how short the eBPF program may trim the packet
*
* Run the filter code and then cut skb->data to correct size returned by
* sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller
@@ -78,7 +79,7 @@ static inline void *load_pointer(const struct sk_buff *skb, int k,
* be accepted or -EPERM if the packet should be tossed.
*
*/
-int sk_filter(struct sock *sk, struct sk_buff *skb)
+int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap)
{
int err;
struct sk_filter *filter;
@@ -99,14 +100,13 @@ int sk_filter(struct sock *sk, struct sk_buff *skb)
filter = rcu_dereference(sk->sk_filter);
if (filter) {
unsigned int pkt_len = SK_RUN_FILTER(filter, skb);
-
- err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
+ err = pkt_len ? pskb_trim(skb, max(cap, pkt_len)) : -EPERM;
}
rcu_read_unlock();
return err;
}
-EXPORT_SYMBOL(sk_filter);
+EXPORT_SYMBOL(sk_filter_trim_cap);
/**
* sk_run_filter - run a filter on a socket