diff options
author | Elena Reshetova <elena.reshetova@intel.com> | 2017-03-03 04:15:07 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-05-04 03:19:18 -0400 |
commit | 805692d0e0f7dec42b5e05fb8b2a5c172f66a3c2 (patch) | |
tree | c12a31d63fa29a8d5dba953d484b835b25a4b71a /fs/ceph/caps.c | |
parent | 3997c01d260ed00d712b051fdab022a08719441e (diff) |
ceph: convert ceph_cap_snap.nref 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: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 68c78be19d5b..60185434162a 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1389,7 +1389,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci, | |||
1389 | first_tid = cf->tid + 1; | 1389 | first_tid = cf->tid + 1; |
1390 | 1390 | ||
1391 | capsnap = container_of(cf, struct ceph_cap_snap, cap_flush); | 1391 | capsnap = container_of(cf, struct ceph_cap_snap, cap_flush); |
1392 | atomic_inc(&capsnap->nref); | 1392 | refcount_inc(&capsnap->nref); |
1393 | spin_unlock(&ci->i_ceph_lock); | 1393 | spin_unlock(&ci->i_ceph_lock); |
1394 | 1394 | ||
1395 | dout("__flush_snaps %p capsnap %p tid %llu %s\n", | 1395 | dout("__flush_snaps %p capsnap %p tid %llu %s\n", |
@@ -2202,7 +2202,7 @@ static void __kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
2202 | inode, capsnap, cf->tid, | 2202 | inode, capsnap, cf->tid, |
2203 | ceph_cap_string(capsnap->dirty)); | 2203 | ceph_cap_string(capsnap->dirty)); |
2204 | 2204 | ||
2205 | atomic_inc(&capsnap->nref); | 2205 | refcount_inc(&capsnap->nref); |
2206 | spin_unlock(&ci->i_ceph_lock); | 2206 | spin_unlock(&ci->i_ceph_lock); |
2207 | 2207 | ||
2208 | ret = __send_flush_snap(inode, session, capsnap, cap->mseq, | 2208 | ret = __send_flush_snap(inode, session, capsnap, cap->mseq, |