mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
net: convert sock.sk_wmem_alloc 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
2638595afc
commit
14afee4b60
37 changed files with 74 additions and 85 deletions
|
|
@ -360,7 +360,7 @@ static unsigned int pn_socket_poll(struct file *file, struct socket *sock,
|
|||
return POLLHUP;
|
||||
|
||||
if (sk->sk_state == TCP_ESTABLISHED &&
|
||||
atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf &&
|
||||
refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf &&
|
||||
atomic_read(&pn->tx_credits))
|
||||
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue