diff options
author | Elena Reshetova <elena.reshetova@intel.com> | 2017-03-03 10:55:19 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-04-18 14:07:23 +0200 |
commit | b7ac31b7b2ebd735b7b67c85711ef6d16648051a (patch) | |
tree | 4acdfe77d40d90f920760a9bacba027864e99836 /fs/btrfs/extent_io.h | |
parent | 0700cea7c8b387c8c6bc4de79b197baa0b3fc4a3 (diff) | |
download | lwn-b7ac31b7b2ebd735b7b67c85711ef6d16648051a.tar.gz lwn-b7ac31b7b2ebd735b7b67c85711ef6d16648051a.zip |
btrfs: convert extent_state.refs from atomic_t to refcount_t
refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r-- | fs/btrfs/extent_io.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 3e4fad4a909d..8d2d6e4272d5 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -2,6 +2,7 @@ #define __EXTENTIO__ #include <linux/rbtree.h> +#include <linux/refcount.h> #include "ulist.h" /* bits for the extent state */ @@ -143,7 +144,7 @@ struct extent_state { /* ADD NEW ELEMENTS AFTER THIS */ wait_queue_head_t wq; - atomic_t refs; + refcount_t refs; unsigned state; struct io_failure_record *failrec; |