mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: convert neighbour.refcnt 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>
This commit is contained in:
parent
1cc9a98b59
commit
9f23743017
6 changed files with 18 additions and 17 deletions
|
@ -28,7 +28,7 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32
|
|||
|
||||
rcu_read_lock_bh();
|
||||
n = __ipv4_neigh_lookup_noref(dev, key);
|
||||
if (n && !atomic_inc_not_zero(&n->refcnt))
|
||||
if (n && !refcount_inc_not_zero(&n->refcnt))
|
||||
n = NULL;
|
||||
rcu_read_unlock_bh();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue