Home
last modified time | relevance | path

Searched refs:fprog (Results 1 – 10 of 10) sorted by relevance

/linux/drivers/net/team/
H A Dteam_mode_loadbalance.c257 struct sock_fprog_kern *fprog; in __fprog_create() local
262 fprog = kmalloc(sizeof(*fprog), GFP_KERNEL); in __fprog_create()
263 if (!fprog) in __fprog_create()
265 fprog->filter = kmemdup(filter, data_len, GFP_KERNEL); in __fprog_create()
266 if (!fprog->filter) { in __fprog_create()
267 kfree(fprog); in __fprog_create()
270 fprog->len = data_len / sizeof(struct sock_filter); in __fprog_create()
271 *pfprog = fprog; in __fprog_create()
275 static void __fprog_destroy(struct sock_fprog_kern *fprog) in __fprog_destroy() argument
277 kfree(fprog->filter); in __fprog_destroy()
[all …]
/linux/kernel/
H A Dseccomp.c661 static struct seccomp_filter *seccomp_prepare_filter(struct sock_fprog *fprog) in seccomp_prepare_filter() argument
672 if (fprog->len == 0 || fprog->len > BPF_MAXINSNS) in seccomp_prepare_filter()
675 BUG_ON(INT_MAX / fprog->len < sizeof(struct sock_filter)); in seccomp_prepare_filter()
693 ret = bpf_prog_create_from_user(&sfilter->prog, fprog, in seccomp_prepare_filter()
716 struct sock_fprog fprog; in seccomp_prepare_user_filter() local
724 fprog.len = fprog32.len; in seccomp_prepare_user_filter()
725 fprog.filter = compat_ptr(fprog32.filter); in seccomp_prepare_user_filter()
728 if (copy_from_user(&fprog, user_filter, sizeof(fprog))) in seccomp_prepare_user_filter()
730 filter = seccomp_prepare_filter(&fprog); in seccomp_prepare_user_filter()
742 static bool seccomp_is_const_allow(struct sock_fprog_kern *fprog, in seccomp_is_const_allow() argument
[all …]
/linux/net/core/
H A Dsock_diag.c79 struct sock_fprog_kern *fprog; in sock_diag_put_filterinfo() local
95 fprog = filter->prog->orig_prog; in sock_diag_put_filterinfo()
96 if (!fprog) in sock_diag_put_filterinfo()
99 flen = bpf_classic_proglen(fprog); in sock_diag_put_filterinfo()
107 memcpy(nla_data(attr), fprog->filter, flen); in sock_diag_put_filterinfo()
H A Dfilter.c1143 const struct sock_fprog *fprog) in bpf_prog_store_orig_filter() argument
1145 unsigned int fsize = bpf_classic_proglen(fprog); in bpf_prog_store_orig_filter()
1153 fkprog->len = fprog->len; in bpf_prog_store_orig_filter()
1167 struct sock_fprog_kern *fprog = fp->orig_prog; in bpf_release_orig_filter() local
1169 if (fprog) { in bpf_release_orig_filter()
1170 kfree(fprog->filter); in bpf_release_orig_filter()
1171 kfree(fprog); in bpf_release_orig_filter()
1370 int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog) in bpf_prog_create() argument
1372 unsigned int fsize = bpf_classic_proglen(fprog); in bpf_prog_create()
1376 if (!bpf_check_basics_ok(fprog->filter, fprog->len)) in bpf_prog_create()
[all …]
H A Dsock.c1451 struct sock_fprog fprog; in sk_setsockopt() local
1453 ret = copy_bpf_fprog_from_user(&fprog, optval, optlen); in sk_setsockopt()
1455 ret = sk_attach_filter(&fprog, sk); in sk_setsockopt()
1472 struct sock_fprog fprog; in sk_setsockopt() local
1474 ret = copy_bpf_fprog_from_user(&fprog, optval, optlen); in sk_setsockopt()
1476 ret = sk_reuseport_attach_filter(&fprog, sk); in sk_setsockopt()
/linux/include/linux/
H A Dfilter.h1039 #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) argument
1089 int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
1090 int bpf_prog_create_from_user(struct bpf_prog **pfp, struct sock_fprog *fprog,
1094 int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
1096 int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk);
/linux/drivers/net/ppp/
H A Dppp_generic.c581 struct sock_fprog_kern fprog; in get_filter() local
589 fprog.len = uprog->len; in get_filter()
590 fprog.filter = memdup_array_user(uprog->filter, in get_filter()
592 if (IS_ERR(fprog.filter)) in get_filter()
593 return ERR_CAST(fprog.filter); in get_filter()
595 err = bpf_prog_create(&res, &fprog); in get_filter()
596 kfree(fprog.filter); in get_filter()
/linux/drivers/net/
H A Dtun.c196 struct sock_fprog fprog; member
784 err = sk_attach_filter(&tun->fprog, tfile->socket.sk); in tun_attach()
2963 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); in tun_attach_filter()
3352 if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) in __tun_chr_ioctl()
3372 if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) in __tun_chr_ioctl()
/linux/net/packet/
H A Daf_packet.c1639 struct sock_fprog fprog; in fanout_set_data_cbpf() local
1645 ret = copy_bpf_fprog_from_user(&fprog, data, len); in fanout_set_data_cbpf()
1649 ret = bpf_prog_create_from_user(&new, &fprog, NULL, false); in fanout_set_data_cbpf()
/linux/lib/
H A Dtest_bpf.c14791 struct sock_fprog_kern fprog; in generate_filter() local
14796 fprog.filter = fptr; in generate_filter()
14797 fprog.len = flen; in generate_filter()
14799 *err = bpf_prog_create(&fp, &fprog); in generate_filter()
14817 *err, fprog.len); in generate_filter()