diff options
author | Reshetova, Elena <elena.reshetova@intel.com> | 2017-07-04 15:53:17 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-04 22:35:17 +0100 |
commit | 803ea85053b75d35f9ebb3aa7a28db35d82c6d82 (patch) | |
tree | c3533e07eb69e00552a416b1d8b5f3d0e97195d3 /net/rds/rds.h | |
parent | b7f0292094cbe31f82f2cd9623c8356cc7cf9566 (diff) | |
download | linux-stable-803ea85053b75d35f9ebb3aa7a28db35d82c6d82.tar.gz linux-stable-803ea85053b75d35f9ebb3aa7a28db35d82c6d82.tar.bz2 linux-stable-803ea85053b75d35f9ebb3aa7a28db35d82c6d82.zip |
net, rds: convert rds_mr.r_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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/rds.h')
-rw-r--r-- | net/rds/rds.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/rds/rds.h b/net/rds/rds.h index 35ceaa2139c3..ea72d6e33c14 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h @@ -277,7 +277,7 @@ struct rds_incoming { struct rds_mr { struct rb_node r_rb_node; - atomic_t r_refcount; + refcount_t r_refcount; u32 r_key; /* A copy of the creation flags */ @@ -857,7 +857,7 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, void __rds_put_mr_final(struct rds_mr *mr); static inline void rds_mr_put(struct rds_mr *mr) { - if (atomic_dec_and_test(&mr->r_refcount)) + if (refcount_dec_and_test(&mr->r_refcount)) __rds_put_mr_final(mr); } |