diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2014-07-30 20:34:12 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-02 15:02:37 -0700 |
commit | 278571baca2aecf5fb5cb5c8b002dbfa0a6c524c (patch) | |
tree | 51ff4143d22b2e550308681c938afc7c9c10dcdc /include/linux | |
parent | 4330487acfff0cf1d7b14d238583a182e0a444bb (diff) | |
download | linux-stable-278571baca2aecf5fb5cb5c8b002dbfa0a6c524c.tar.gz linux-stable-278571baca2aecf5fb5cb5c8b002dbfa0a6c524c.tar.bz2 linux-stable-278571baca2aecf5fb5cb5c8b002dbfa0a6c524c.zip |
net: filter: simplify socket charging
attaching bpf program to a socket involves multiple socket memory arithmetic,
since size of 'sk_filter' is changing when classic BPF is converted to eBPF.
Also common path of program creation has to deal with two ways of freeing
the memory.
Simplify the code by delaying socket charging until program is ready and
its size is known
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/filter.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index 20dd50ef7271..00640edc166f 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -366,7 +366,7 @@ int sk_chk_filter(const struct sock_filter *filter, unsigned int flen); int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned int len); -void sk_filter_charge(struct sock *sk, struct sk_filter *fp); +bool sk_filter_charge(struct sock *sk, struct sk_filter *fp); void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); |