diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-05-23 12:43:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-23 16:48:05 -0400 |
commit | b1fcd35cf53553a0a3ef949b05106d921446abc3 (patch) | |
tree | 4784eb248a9705f2eae7dcb10968497f0559499f /drivers/net/team | |
parent | 8556ce79d5986a87fee4c29300b4efee07c0f15e (diff) |
net: filter: let unattached filters use sock_fprog_kern
The sk_unattached_filter_create() API is used by BPF filters that
are not directly attached or related to sockets, and are used in
team, ptp, xt_bpf, cls_bpf, etc. As such all users do their own
internal managment of obtaining filter blocks and thus already
have them in kernel memory and set up before calling into
sk_unattached_filter_create(). As a result, due to __user annotation
in sock_fprog, sparse triggers false positives (incorrect type in
assignment [different address space]) when filters are set up before
passing them to sk_unattached_filter_create(). Therefore, let
sk_unattached_filter_create() API use sock_fprog_kern to overcome
this issue.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team')
-rw-r--r-- | drivers/net/team/team_mode_loadbalance.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c index dbde3412ee5e..0a6ee07bf0af 100644 --- a/drivers/net/team/team_mode_loadbalance.c +++ b/drivers/net/team/team_mode_loadbalance.c | |||
@@ -49,7 +49,7 @@ struct lb_port_mapping { | |||
49 | struct lb_priv_ex { | 49 | struct lb_priv_ex { |
50 | struct team *team; | 50 | struct team *team; |
51 | struct lb_port_mapping tx_hash_to_port_mapping[LB_TX_HASHTABLE_SIZE]; | 51 | struct lb_port_mapping tx_hash_to_port_mapping[LB_TX_HASHTABLE_SIZE]; |
52 | struct sock_fprog *orig_fprog; | 52 | struct sock_fprog_kern *orig_fprog; |
53 | struct { | 53 | struct { |
54 | unsigned int refresh_interval; /* in tenths of second */ | 54 | unsigned int refresh_interval; /* in tenths of second */ |
55 | struct delayed_work refresh_dw; | 55 | struct delayed_work refresh_dw; |
@@ -241,10 +241,10 @@ static int lb_bpf_func_get(struct team *team, struct team_gsetter_ctx *ctx) | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | static int __fprog_create(struct sock_fprog **pfprog, u32 data_len, | 244 | static int __fprog_create(struct sock_fprog_kern **pfprog, u32 data_len, |
245 | const void *data) | 245 | const void *data) |
246 | { | 246 | { |
247 | struct sock_fprog *fprog; | 247 | struct sock_fprog_kern *fprog; |
248 | struct sock_filter *filter = (struct sock_filter *) data; | 248 | struct sock_filter *filter = (struct sock_filter *) data; |
249 | 249 | ||
250 | if (data_len % sizeof(struct sock_filter)) | 250 | if (data_len % sizeof(struct sock_filter)) |
@@ -262,7 +262,7 @@ static int __fprog_create(struct sock_fprog **pfprog, u32 data_len, | |||
262 | return 0; | 262 | return 0; |
263 | } | 263 | } |
264 | 264 | ||
265 | static void __fprog_destroy(struct sock_fprog *fprog) | 265 | static void __fprog_destroy(struct sock_fprog_kern *fprog) |
266 | { | 266 | { |
267 | kfree(fprog->filter); | 267 | kfree(fprog->filter); |
268 | kfree(fprog); | 268 | kfree(fprog); |
@@ -273,7 +273,7 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx) | |||
273 | struct lb_priv *lb_priv = get_lb_priv(team); | 273 | struct lb_priv *lb_priv = get_lb_priv(team); |
274 | struct sk_filter *fp = NULL; | 274 | struct sk_filter *fp = NULL; |
275 | struct sk_filter *orig_fp; | 275 | struct sk_filter *orig_fp; |
276 | struct sock_fprog *fprog = NULL; | 276 | struct sock_fprog_kern *fprog = NULL; |
277 | int err; | 277 | int err; |
278 | 278 | ||
279 | if (ctx->data.bin_val.len) { | 279 | if (ctx->data.bin_val.len) { |