diff options
author | Elena Reshetova <elena.reshetova@intel.com> | 2017-10-20 12:53:32 +0300 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-11-17 13:47:59 -0500 |
commit | eba6dd691743a9d7a57735f36bf6946fc58878ec (patch) | |
tree | e6b14b8b629462d1e7707bd32536292e91bccef0 /fs/nfs/pnfs.h | |
parent | a2a5dea7b6cb77365ed9c987f54d160668c8a95f (diff) | |
download | linux-eba6dd691743a9d7a57735f36bf6946fc58878ec.tar.gz linux-eba6dd691743a9d7a57735f36bf6946fc58878ec.tar.bz2 linux-eba6dd691743a9d7a57735f36bf6946fc58878ec.zip |
fs, nfs: convert pnfs_layout_segment.pls_refcount 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: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r-- | fs/nfs/pnfs.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index cefa7daf6e85..f0e98e1f04b2 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -64,7 +64,7 @@ struct pnfs_layout_segment { struct list_head pls_list; struct list_head pls_lc_list; struct pnfs_layout_range pls_range; - atomic_t pls_refcount; + refcount_t pls_refcount; u32 pls_seq; unsigned long pls_flags; struct pnfs_layout_hdr *pls_layout; @@ -394,7 +394,7 @@ static inline struct pnfs_layout_segment * pnfs_get_lseg(struct pnfs_layout_segment *lseg) { if (lseg) { - atomic_inc(&lseg->pls_refcount); + refcount_inc(&lseg->pls_refcount); smp_mb__after_atomic(); } return lseg; |