Now when new refcount_t type and API are finally merged (see include/linux/refcount.h), the following patches convert various refcounters in the generic fs code from atomic_t to refcount_t. By doing this we prevent intentional or accidental underflows or overflows that can led to use-after-free vulnerabilities. The below patches are fully independent and can be cherry-picked separately. Since we convert all kernel subsystems in the same fashion, resulting in about 300 patches, we have to group them for sending at least in some fashion to be manageable. Please excuse the long cc list. Run-time tested using xfstests with xfs and ext4 filesystems. refcount WARNs were on and no issues related to changes were encounted during running the tests. Elena Reshetova (5): fs: convert mb_cache_entry.e_refcnt from atomic_t to refcount_t fs: convert posix_acl.a_refcount from atomic_t to refcount_t fs: convert mnt_namespace.count from atomic_t to refcount_t fs: convert super_block.s_active from atomic_t to refcount_t fs: convert userfaultfd_ctx.refcount from atomic_t to refcount_t drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- fs/cifs/cifsfs.c | 2 +- fs/devpts/inode.c | 2 +- fs/f2fs/acl.c | 2 +- fs/gfs2/super.c | 2 +- fs/kernfs/mount.c | 2 +- fs/mbcache.c | 16 ++++++++-------- fs/mount.h | 5 +++-- fs/namespace.c | 8 ++++---- fs/nfs/super.c | 4 ++-- fs/posix_acl.c | 6 +++--- fs/super.c | 10 +++++----- fs/userfaultfd.c | 11 ++++++----- include/linux/fs.h | 3 ++- include/linux/mbcache.h | 6 +++--- include/linux/posix_acl.h | 7 ++++--- 16 files changed, 46 insertions(+), 42 deletions(-) -- 2.7.4