linux-brain/net/sunrpc
Laura Abbott e9ec911158 sunrpc: Don't use stack buffer with scatterlist
[ Upstream commit 44090cc876 ]

Fedora got a bug report from NFS:

kernel BUG at include/linux/scatterlist.h:143!
...
RIP: 0010:sg_init_one+0x7d/0x90
..
  make_checksum+0x4e7/0x760 [rpcsec_gss_krb5]
  gss_get_mic_kerberos+0x26e/0x310 [rpcsec_gss_krb5]
  gss_marshal+0x126/0x1a0 [auth_rpcgss]
  ? __local_bh_enable_ip+0x80/0xe0
  ? call_transmit_status+0x1d0/0x1d0 [sunrpc]
  call_transmit+0x137/0x230 [sunrpc]
  __rpc_execute+0x9b/0x490 [sunrpc]
  rpc_run_task+0x119/0x150 [sunrpc]
  nfs4_run_exchange_id+0x1bd/0x250 [nfsv4]
  _nfs4_proc_exchange_id+0x2d/0x490 [nfsv4]
  nfs41_discover_server_trunking+0x1c/0xa0 [nfsv4]
  nfs4_discover_server_trunking+0x80/0x270 [nfsv4]
  nfs4_init_client+0x16e/0x240 [nfsv4]
  ? nfs_get_client+0x4c9/0x5d0 [nfs]
  ? _raw_spin_unlock+0x24/0x30
  ? nfs_get_client+0x4c9/0x5d0 [nfs]
  nfs4_set_client+0xb2/0x100 [nfsv4]
  nfs4_create_server+0xff/0x290 [nfsv4]
  nfs4_remote_mount+0x28/0x50 [nfsv4]
  mount_fs+0x3b/0x16a
  vfs_kern_mount.part.35+0x54/0x160
  nfs_do_root_mount+0x7f/0xc0 [nfsv4]
  nfs4_try_mount+0x43/0x70 [nfsv4]
  ? get_nfs_version+0x21/0x80 [nfs]
  nfs_fs_mount+0x789/0xbf0 [nfs]
  ? pcpu_alloc+0x6ca/0x7e0
  ? nfs_clone_super+0x70/0x70 [nfs]
  ? nfs_parse_mount_options+0xb40/0xb40 [nfs]
  mount_fs+0x3b/0x16a
  vfs_kern_mount.part.35+0x54/0x160
  do_mount+0x1fd/0xd50
  ksys_mount+0xba/0xd0
  __x64_sys_mount+0x21/0x30
  do_syscall_64+0x60/0x1f0
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

This is BUG_ON(!virt_addr_valid(buf)) triggered by using a stack
allocated buffer with a scatterlist. Convert the buffer for
rc4salt to be dynamically allocated instead.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1615258
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-15 09:42:57 +02:00
..
auth_gss sunrpc: Don't use stack buffer with scatterlist 2018-09-15 09:42:57 +02:00
xprtrdma xprtrdma: Return -ENOBUFS when no pages are available 2018-07-25 11:24:02 +02:00
addr.c replace strict_strto calls 2014-07-12 18:45:49 -04:00
auth_generic.c NFS client updates for Linux 4.9 2016-10-13 21:28:20 -07:00
auth_null.c sunrpc: move NO_CRKEY_TIMEOUT to the auth->au_flags 2016-07-19 16:23:24 -04:00
auth_unix.c NFS client updates for Linux 4.9 2016-10-13 21:28:20 -07:00
auth.c sunrpc: replace generic auth_cred hash with auth-specific function 2016-09-30 15:47:47 -04:00
backchannel_rqst.c SUNRPC: Refactor rpc_xdr_buf_init() 2016-09-19 13:08:37 -04:00
cache.c sunrpc: queue work on system_power_efficient_wq 2016-09-27 14:35:36 -04:00
clnt.c NFSv4 client live hangs after live data migration recovery 2018-09-09 20:01:23 +02:00
debugfs.c SUNRPC: Address kbuild warning in net/sunrpc/debugfs.c 2015-06-11 14:01:06 -04:00
Kconfig rpcrdma: Merge svcrdma and xprtrdma modules into one 2015-06-04 16:56:02 -04:00
Makefile SUNRPC: Add a structure to track multiple transports 2016-02-05 18:48:54 -05:00
netns.h Merge branch 'for-3.14' of git://linux-nfs.org/~bfields/linux 2014-01-30 10:18:43 -08:00
rpc_pipe.c rpc_pipefs: fix double-dput() 2018-04-24 09:34:17 +02:00
rpcb_clnt.c SUNRPC: Use the multipath iterator to assign a transport to each task 2016-02-05 18:48:55 -05:00
sched.c sunrpc: Fix rpc_task_begin trace point 2017-12-14 09:28:23 +01:00
socklib.c sunrpc: do not pull udp headers on receive 2016-04-11 15:31:33 -04:00
stats.c sunrpc: add rpc_count_iostats_idx 2015-02-03 11:06:38 -08:00
sunrpc_syms.c SUNRPC: cleanup ida information when removing sunrpc module 2017-02-01 08:33:09 +01:00
sunrpc.h SUNRPC: track whether a request is coming from a loop-back interface. 2014-05-22 15:59:18 -04:00
svc_xprt.c sunrpc: don't call sleeping functions from the notifier block callbacks 2017-01-26 08:24:37 +01:00
svc.c NFSv4: Fix callback server shutdown 2017-09-27 14:39:18 +02:00
svcauth_unix.c kernel: make groups_sort calling a responsibility group_info allocators 2018-01-10 09:29:52 +01:00
svcauth.c svcrpc: move some initialization to common code 2015-11-24 10:39:16 -07:00
svcsock.c net: sunrpc: svcsock: fix NULL-pointer exception 2017-08-30 10:21:51 +02:00
sysctl.c Sunrpc: Supports hexadecimal number for sysctl files of sunrpc debug 2015-11-03 15:56:49 -05:00
timer.c net: cleanup unsigned to unsigned int 2012-04-15 12:44:40 -04:00
xdr.c SUNRPC: Fix setting of buffer length in xdr_set_next_buffer() 2016-09-22 17:17:47 -04:00
xprt.c SUNRPC: Generalize the RPC buffer release API 2016-09-19 13:08:37 -04:00
xprtmultipath.c SUNRPC search xprt switch for sockaddr 2016-09-19 13:08:36 -04:00
xprtsock.c SUNRPC: ensure correct error is reported by xs_tcp_setup_socket() 2018-04-13 19:48:14 +02:00