diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-06 17:13:21 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-06 17:13:21 -0800 |
commit | 75d4276e83a353d5e41da676f418d4a12f6f6e6c (patch) | |
tree | d3d9a43afa64f5d358b99b987b7ad8c0e2847dac /net | |
parent | 5b6c02f38315b720c593c6079364855d276886aa (diff) | |
parent | 040ee69226f8a96b7943645d68f41d5d44b5ff7d (diff) | |
download | linux-75d4276e83a353d5e41da676f418d4a12f6f6e6c.tar.gz linux-75d4276e83a353d5e41da676f418d4a12f6f6e6c.tar.bz2 linux-75d4276e83a353d5e41da676f418d4a12f6f6e6c.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro:
- untangle sys_close() abuses in xt_bpf
- deal with register_shrinker() failures in sget()
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fix "netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'"
sget(): handle failures of register_shrinker()
mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed.
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/xt_bpf.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/net/netfilter/xt_bpf.c b/net/netfilter/xt_bpf.c index 1f7fbd3c7e5a..06b090d8e901 100644 --- a/net/netfilter/xt_bpf.c +++ b/net/netfilter/xt_bpf.c @@ -55,21 +55,11 @@ static int __bpf_mt_check_fd(int fd, struct bpf_prog **ret) static int __bpf_mt_check_path(const char *path, struct bpf_prog **ret) { - mm_segment_t oldfs = get_fs(); - int retval, fd; - if (strnlen(path, XT_BPF_PATH_MAX) == XT_BPF_PATH_MAX) return -EINVAL; - set_fs(KERNEL_DS); - fd = bpf_obj_get_user(path, 0); - set_fs(oldfs); - if (fd < 0) - return fd; - - retval = __bpf_mt_check_fd(fd, ret); - sys_close(fd); - return retval; + *ret = bpf_prog_get_type_path(path, BPF_PROG_TYPE_SOCKET_FILTER); + return PTR_ERR_OR_ZERO(*ret); } static int bpf_mt_check(const struct xt_mtchk_param *par) |