From: Linus Torvalds Date: Sun, 7 Jan 2018 01:13:21 +0000 (-0800) Subject: Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=75d4276e83a353d5e41da676f418d4a12f6f6e6c;p=openwrt%2Fstaging%2Fblogic.git Merge branch 'for-linus' of git://git./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. --- 75d4276e83a353d5e41da676f418d4a12f6f6e6c diff --cc net/netfilter/xt_bpf.c index 1f7fbd3c7e5a,fa2ca0a13619..06b090d8e901 --- a/net/netfilter/xt_bpf.c +++ b/net/netfilter/xt_bpf.c @@@ -55,21 -52,8 +55,11 @@@ static int __bpf_mt_check_fd(int fd, st 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)