Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 7 Jan 2018 01:13:21 +0000 (17:13 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 7 Jan 2018 01:13:21 +0000 (17:13 -0800)
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.

1  2 
net/netfilter/xt_bpf.c

index 1f7fbd3c7e5a6de0cbe7e0bb5c847a98df371aff,fa2ca0a13619381e53cd89ab957bf927cc2ccf37..06b090d8e9014d6bf6adfb742b5c2620197b98fb
@@@ -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)