net: convert sock.sk_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. This patch uses refcount_inc_not_zero() instead of atomic_inc_not_zero_hint() due to absense of a _hint() version of refcount API. If the hint() version must be used, we might need to revisit API. 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>
Showing
- crypto/algif_aead.c 1 addition, 1 deletioncrypto/algif_aead.c
- include/net/inet_hashtables.h 2 additions, 2 deletionsinclude/net/inet_hashtables.h
- include/net/request_sock.h 5 additions, 4 deletionsinclude/net/request_sock.h
- include/net/sock.h 9 additions, 8 deletionsinclude/net/sock.h
- net/atm/proc.c 1 addition, 1 deletionnet/atm/proc.c
- net/bluetooth/af_bluetooth.c 1 addition, 1 deletionnet/bluetooth/af_bluetooth.c
- net/bluetooth/rfcomm/sock.c 1 addition, 1 deletionnet/bluetooth/rfcomm/sock.c
- net/core/skbuff.c 3 additions, 3 deletionsnet/core/skbuff.c
- net/core/sock.c 3 additions, 3 deletionsnet/core/sock.c
- net/ipv4/inet_connection_sock.c 1 addition, 1 deletionnet/ipv4/inet_connection_sock.c
- net/ipv4/inet_hashtables.c 2 additions, 2 deletionsnet/ipv4/inet_hashtables.c
- net/ipv4/inet_timewait_sock.c 4 additions, 4 deletionsnet/ipv4/inet_timewait_sock.c
- net/ipv4/ping.c 2 additions, 2 deletionsnet/ipv4/ping.c
- net/ipv4/raw.c 1 addition, 1 deletionnet/ipv4/raw.c
- net/ipv4/syncookies.c 1 addition, 1 deletionnet/ipv4/syncookies.c
- net/ipv4/tcp_fastopen.c 1 addition, 1 deletionnet/ipv4/tcp_fastopen.c
- net/ipv4/tcp_ipv4.c 2 additions, 2 deletionsnet/ipv4/tcp_ipv4.c
- net/ipv4/udp.c 3 additions, 3 deletionsnet/ipv4/udp.c
- net/ipv4/udp_diag.c 2 additions, 2 deletionsnet/ipv4/udp_diag.c
- net/ipv6/datagram.c 1 addition, 1 deletionnet/ipv6/datagram.c
Loading
Please register or sign in to comment