net: convert sock.sk_refcnt from atomic_t to refcount_t
authorReshetova, Elena <elena.reshetova@intel.com>
Fri, 30 Jun 2017 10:08:01 +0000 (13:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Jul 2017 14:39:08 +0000 (07:39 -0700)
commit41c6d650f6537e55a1b53438c646fbc3f49176bf
treed7fb3d5a2f1b3fb0fe76fa010141be563488d36b
parent14afee4b6092fde451ee17604e5f5c89da33e71e
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>
35 files changed:
crypto/algif_aead.c
include/net/inet_hashtables.h
include/net/request_sock.h
include/net/sock.h
net/atm/proc.c
net/bluetooth/af_bluetooth.c
net/bluetooth/rfcomm/sock.c
net/core/skbuff.c
net/core/sock.c
net/ipv4/inet_connection_sock.c
net/ipv4/inet_hashtables.c
net/ipv4/inet_timewait_sock.c
net/ipv4/ping.c
net/ipv4/raw.c
net/ipv4/syncookies.c
net/ipv4/tcp_fastopen.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv4/udp_diag.c
net/ipv6/datagram.c
net/ipv6/inet6_hashtables.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/key/af_key.c
net/l2tp/l2tp_debugfs.c
net/llc/llc_conn.c
net/llc/llc_sap.c
net/netfilter/xt_TPROXY.c
net/netlink/af_netlink.c
net/packet/af_packet.c
net/phonet/socket.c
net/rxrpc/af_rxrpc.c
net/sched/em_meta.c
net/tipc/socket.c
net/unix/af_unix.c