mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
net: convert sk_buff.users 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 <[email protected]> Signed-off-by: Hans Liljestrand <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David Windsor <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
53869cebce
commit
633547973f
21 changed files with 67 additions and 67 deletions
|
|
@ -203,11 +203,11 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
|
|||
|
||||
sock_hold(sk);
|
||||
if (*skb2 == NULL) {
|
||||
if (atomic_read(&skb->users) != 1) {
|
||||
if (refcount_read(&skb->users) != 1) {
|
||||
*skb2 = skb_clone(skb, allocation);
|
||||
} else {
|
||||
*skb2 = skb;
|
||||
atomic_inc(&skb->users);
|
||||
refcount_inc(&skb->users);
|
||||
}
|
||||
}
|
||||
if (*skb2 != NULL) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue