android_kernel_oneplus_msm8998/net/sunrpc
NeilBrown fad5152130 sunrpc: don't mark uninitialised items as VALID.
commit d58431eacb226222430940134d97bfd72f292fcd upstream.

A recent commit added a call to cache_fresh_locked()
when an expired item was found.
The call sets the CACHE_VALID flag, so it is important
that the item actually is valid.
There are two ways it could be valid:
1/ If ->update has been called to fill in relevant content
2/ if CACHE_NEGATIVE is set, to say that content doesn't exist.

An expired item that is waiting for an update will be neither.
Setting CACHE_VALID will mean that a subsequent call to cache_put()
will be likely to dereference uninitialised pointers.

So we must make sure the item is valid, and we already have code to do
that in try_to_negate_entry().  This takes the hash lock and so cannot
be used directly, so take out the two lines that we need and use them.

Now cache_fresh_locked() is certain to be called only on
a valid item.

Cc: stable@kernel.org # 2.6.35
Fixes: 4ecd55ea0742 ("sunrpc: fix cache_head leak due to queued request")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-16 19:44:44 +02:00
..
auth_gss sunrpc: use SVC_NET() in svcauth_gss_* functions 2019-01-13 10:05:32 +01:00
xprtrdma svcrdma: avoid duplicate dma unmapping during error recovery 2017-01-26 08:23:48 +01:00
addr.c
auth.c kernel/params: constify struct kernel_param_ops uses 2015-05-28 11:32:10 +09:30
auth_generic.c SUNRPC: Fix a bogus get/put in generic_key_to_expire() 2018-12-01 09:46:34 +01:00
auth_null.c
auth_unix.c sunrpc: increase UNX_MAXNODENAME from 32 to __NEW_UTS_LEN bytes 2015-08-12 14:31:04 -04:00
backchannel_rqst.c SUNRPC: Fix callback channel 2015-12-07 13:04:59 -08:00
cache.c sunrpc: don't mark uninitialised items as VALID. 2019-05-16 19:44:44 +02:00
clnt.c SUNRPC: cleanup ida information when removing sunrpc module 2017-02-01 08:30:53 +01: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 NFS client updates for Linux 4.2 2015-07-02 11:32:23 -07:00
netns.h
rpc_pipe.c rpc_pipefs: fix double-dput() 2018-04-24 09:32:11 +02:00
rpcb_clnt.c sunrpc: handle ENOMEM in rpcb_getport_async 2019-01-26 09:42:51 +01:00
sched.c sunrpc: Fix rpc_task_begin trace point 2017-12-16 10:33:55 +01:00
socklib.c
stats.c sunrpc: add rpc_count_iostats_idx 2015-02-03 11:06:38 -08:00
sunrpc.h
sunrpc_syms.c SUNRPC: cleanup ida information when removing sunrpc module 2017-02-01 08:30:53 +01:00
svc.c sunrpc: use-after-free in svc_process_common() 2019-01-16 22:16:12 +01:00
svc_xprt.c sunrpc: use-after-free in svc_process_common() 2019-01-16 22:16:12 +01:00
svcauth.c
svcauth_unix.c kernel: make groups_sort calling a responsibility group_info allocators 2018-01-10 09:27:10 +01:00
svcsock.c sunrpc: use-after-free in svc_process_common() 2019-01-16 22:16:12 +01:00
sysctl.c Sunrpc: Supports hexadecimal number for sysctl files of sunrpc debug 2015-11-03 15:56:49 -05:00
timer.c
xdr.c SUNRPC: drop pointless static qualifier in xdr_get_next_encode_buffer() 2018-11-27 16:08:01 +01:00
xprt.c SUNRPC: Fix a potential race in xprt_connect() 2018-12-21 14:09:52 +01:00
xprtsock.c SUNRPC: ensure correct error is reported by xs_tcp_setup_socket() 2018-04-13 19:50:15 +02:00