linux-sg2042/fs/nfs
Elena Reshetova 2f62b5aa48 fs, nfs: convert nfs_lock_context.count from atomic_t to refcount_t
atomic_t variables are currently used to implement reference
counters with the following properties:
 - counter is initialized to 1 using atomic_set()
 - a resource is freed upon counter reaching zero
 - once counter reaches zero, its further
   increments aren't allowed
 - counter schema uses basic atomic operations
   (set, inc, inc_not_zero, dec_and_test, etc.)

Such atomic variables should be converted to a newly provided
refcount_t type and API that prevents accidental counter overflows
and underflows. This is important since overflows and underflows
can lead to use-after-free situation and be exploitable.

The variable nfs_lock_context.count is used as pure reference counter.
Convert it to refcount_t and fix up the operations.

Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: David Windsor <dwindsor@gmail.com>
Reviewed-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-11-17 13:48:01 -05:00
..
blocklayout block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
filelayout nfs/filelayout: fix oops when freeing filelayout segment 2017-10-01 18:51:30 -04:00
flexfilelayout fs, nfs: convert nfs4_ff_layout_mirror.ref from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
Kconfig pnfs/blocklayout: require 64-bit sector_t 2017-08-11 14:10:13 -04:00
Makefile nfs: add export operations 2017-07-13 17:12:04 -04:00
cache_lib.c fs, nfs: convert nfs_cache_defer_req.count from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
cache_lib.h fs, nfs: convert nfs_cache_defer_req.count from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
callback.c sunrpc: Const-ify struct sv_serv_ops 2017-08-24 22:13:50 -04:00
callback.h nfs: don't cast callback decode/proc/encode routines 2017-07-13 15:57:56 -04:00
callback_proc.c NFS: Use an atomic_long_t to count the number of requests 2017-08-15 11:54:47 -04:00
callback_xdr.c Chuck's RDMA update overhauls the "call receive" side of the 2017-07-13 13:56:24 -07:00
client.c NFS: Fix uninitialized rpc_wait_queue 2017-10-01 18:51:30 -04:00
delegation.c NFS: Use an atomic_long_t to count the number of requests 2017-08-15 11:54:47 -04:00
delegation.h NFSv4: nfs_inode_find_state_and_recover() should check all stateids 2016-09-27 14:34:35 -04:00
dir.c NFS: remove special-case revalidate in nfs_opendir() 2017-10-16 13:51:27 -04:00
direct.c NFSv4: Use a mutex to protect the per-inode commit lists 2017-08-15 11:54:47 -04:00
dns_resolve.c NFS: Enabling v4.2 should not recompile nfsd and lockd 2013-11-19 16:20:40 -05:00
dns_resolve.h
export.c nfs: add export operations 2017-07-13 17:12:04 -04:00
file.c NFS: various changes relating to reporting IO errors. 2017-09-11 22:28:56 -04:00
fscache-index.c fscache: remove unused ->now_uncached callback 2017-09-06 17:27:26 -07:00
fscache.c nfs: define nfs_inc_fscache_stats and using it as possible 2014-11-24 20:08:47 -05:00
fscache.h
getroot.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
inode.c fs, nfs: convert nfs_lock_context.count from atomic_t to refcount_t 2017-11-17 13:48:01 -05:00
internal.h NFS: various changes relating to reporting IO errors. 2017-09-11 22:28:56 -04:00
io.c NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
iostat.h nfs: define nfs_inc_fscache_stats and using it as possible 2014-11-24 20:08:47 -05:00
mount_clnt.c nfs: count correct array for mnt3_counts array size 2017-07-21 08:49:57 -04:00
namespace.c NFS: Use ERR_CAST() to avoid cross-structure cast 2017-05-28 10:11:47 -07:00
netns.h netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
nfs.h
nfs2super.c
nfs2xdr.c NFS: convert flags to bool 2017-07-13 15:58:04 -04:00
nfs3_fs.h nfsv3: introduce nfs3_set_ds_client 2015-02-03 11:06:34 -08:00
nfs3acl.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
nfs3client.c NFS: Remove unused authflavour parameter from nfs_get_client() 2016-12-01 17:46:32 -05:00
nfs3proc.c NFS: Don't compare apples to elephants to determine access bits 2017-10-16 13:51:27 -04:00
nfs3super.c nfsv3: introduce nfs3_set_ds_client 2015-02-03 11:06:34 -08:00
nfs3xdr.c NFS: convert flags to bool 2017-07-13 15:58:04 -04:00
nfs4_fs.h fs, nfs: convert nfs4_lock_state.ls_count from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
nfs4client.c NFSv4: Fix double frees in nfs4_test_session_trunk() 2017-08-02 09:45:55 -04:00
nfs4file.c NFSv4: add flock_owner to open context 2016-12-01 17:57:27 -05:00
nfs4getroot.c NFS: Clean up nfs4_get_rootfh() 2017-04-20 13:39:35 -04:00
nfs4idmap.c NFS: Cleanup error handling in nfs_idmap_request_key() 2017-10-01 18:51:30 -04:00
nfs4idmap.h NFS: Move nfs_idmap.h into fs/nfs/ 2015-04-23 15:16:14 -04:00
nfs4namespace.c NFS: Remove extra dprintk()s from nfs4namespace.c 2017-04-20 13:39:35 -04:00
nfs4proc.c fs, nfs: convert nfs4_lock_state.ls_count from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
nfs4renewd.c NFSv4: Set the connection timeout to match the lease period 2017-02-09 14:15:16 -05:00
nfs4session.c NFSv4.1: Fix regression in callback retry handling 2016-12-01 17:21:38 -05:00
nfs4session.h NFS: Make trace_nfs4_setup_sequence() available to NFS v4.0 2017-01-30 13:14:50 -05:00
nfs4state.c fs, nfs: convert nfs4_lock_state.ls_count from atomic_t to refcount_t 2017-11-17 13:48:00 -05:00
nfs4super.c NFS: Move nfs_idmap.h into fs/nfs/ 2015-04-23 15:16:14 -04:00
nfs4sysctl.c nfs: do not initialise statics to 0 2015-12-28 09:57:15 -05:00
nfs4trace.c pNFS: Modify pnfs_update_layout tracepoints to use layout stateid 2015-12-28 09:57:14 -05:00
nfs4trace.h nfs4: add NFSv4 LOOKUPP handlers 2017-07-13 16:00:15 -04:00
nfs4xdr.c nfs: RPC_MAX_AUTH_SIZE is in bytes 2017-10-01 18:51:30 -04:00
nfs42.h NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs42proc.c NFSv4.2 fix size storage for nfs42_proc_copy 2017-07-13 16:00:14 -04:00
nfs42xdr.c nfs: fix decoder callback prototypes 2017-07-13 15:57:56 -04:00
nfsroot.c nfsroot: make nfsroot to accept the 1024 bytes long directory name 2015-10-21 15:49:19 -05:00
nfstrace.c NFSv4: Allow tracing of NFSv4 fsync calls 2015-03-27 12:39:34 -04:00
nfstrace.h NFS: Add static NFS I/O tracepoints 2017-09-11 22:20:38 -04:00
pagelist.c NFS: various changes relating to reporting IO errors. 2017-09-11 22:28:56 -04:00
pnfs.c fs, nfs: convert pnfs_layout_hdr.plh_refcount from atomic_t to refcount_t 2017-11-17 13:47:59 -05:00
pnfs.h fs, nfs: convert pnfs_layout_hdr.plh_refcount from atomic_t to refcount_t 2017-11-17 13:47:59 -05:00
pnfs_dev.c NFSv4.1: Don't cache deviceids that have no notifications 2015-03-27 12:32:24 -04:00
pnfs_nfs.c fs, nfs: convert nfs4_pnfs_ds.ds_count from atomic_t to refcount_t 2017-11-17 13:47:59 -05:00
proc.c NFS: convert flags to bool 2017-07-13 15:58:04 -04:00
read.c NFS: Add static NFS I/O tracepoints 2017-09-11 22:20:38 -04:00
super.c Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-09-14 18:54:01 -07:00
symlink.c vfs: remove ".readlink = generic_readlink" assignments 2016-12-09 16:45:04 +01:00
sysctl.c nfs: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
unlink.c NFS: nfs_rename() - revalidate directories on -ERESTARTSYS 2017-07-13 15:58:04 -04:00
write.c NFS: various changes relating to reporting IO errors. 2017-09-11 22:28:56 -04:00