linux-stable/fs/notify
Elena Reshetova ab97f87325 fsnotify: convert fsnotify_mark.refcnt 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 fsnotify_mark.refcnt 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: Jan Kara <jack@suse.cz>
2017-10-31 17:54:56 +01:00
..
dnotify dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify() 2017-10-31 17:41:04 +01:00
fanotify fanotify: clean up CONFIG_FANOTIFY_ACCESS_PERMISSIONS ifdefs 2017-10-31 17:54:56 +01:00
inotify fsnotify: convert fsnotify_mark.refcnt from atomic_t to refcount_t 2017-10-31 17:54:56 +01:00
fdinfo.c fsnotify: Move object pointer to fsnotify_mark_connector 2017-04-10 17:37:35 +02:00
fdinfo.h fs: Convert show_fdinfo functions to void 2014-11-05 14:13:23 -05:00
fsnotify.c fsnotify: clean up fsnotify() 2017-10-31 17:54:56 +01:00
fsnotify.h fsnotify: Remove fsnotify_find_{inode|vfsmount}_mark() 2017-04-10 17:37:36 +02:00
group.c fsnotify: convert fsnotify_group.refcnt from atomic_t to refcount_t 2017-10-31 17:54:56 +01:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
Makefile fsnotify: Drop inode_mark.c 2017-04-10 17:37:36 +02:00
mark.c fsnotify: convert fsnotify_mark.refcnt from atomic_t to refcount_t 2017-10-31 17:54:56 +01:00
notification.c fsnotify: clean up spinlock assertions 2016-10-07 18:46:26 -07:00