android_kernel_samsung_msm8976/net
Willem de Bruijn ff0eab26dc UPSTREAM: packet: hold bind lock when rebinding to fanout hook
[ Upstream commit 008ba2a13f2d04c947adc536d19debb8fe66f110 ]

Packet socket bind operations must hold the po->bind_lock. This keeps
po->running consistent with whether the socket is actually on a ptype
list to receive packets.

fanout_add unbinds a socket and its packet_rcv/tpacket_rcv call, then
binds the fanout object to receive through packet_rcv_fanout.

Make it hold the po->bind_lock when testing po->running and rebinding.
Else, it can race with other rebind operations, such as that in
packet_set_ring from packet_rcv to tpacket_rcv. Concurrent updates
can result in a socket being added to a fanout group twice, causing
use-after-free KASAN bug reports, among others.

Reported independently by both trinity and syzkaller.
Verified that the syzkaller reproducer passes after this patch.

Fixes: dc99f60069 ("packet: Add fanout support.")
Change-Id: I6817d1f12654dd682a962cfd4645006a7315360d
Reported-by: nixioaming <nixiaoming@huawei.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Marissa Wall <marissaw@google.com>
2018-05-26 00:39:35 +02:00
..
9p 9p: forgetting to cancel request on interrupted zero-copy RPC 2015-08-03 09:29:47 -07:00
802
8021q
appletalk
atm
ax25 Import latest Samsung release 2017-04-18 03:43:52 +02:00
batman-adv batman-adv: Fix broadcast/ogm queue limit on a removed interface 2016-06-07 10:42:53 +02:00
bluetooth Bluetooth: cmtp: cmtp_add_connection() should verify that it's dealing with l2cap socket 2017-12-22 20:25:52 +00:00
bridge This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
caif net/unix: sk_socket can disappear when state is unlocked 2015-09-16 18:20:18 +05:30
can can: add missing initialisations in CAN related skbuffs 2015-03-26 15:00:58 +01:00
ceph libceph: introduce ceph_crypt() for in-place en/decryption 2017-04-22 23:02:50 +02:00
core Merge tag 'LA.BR.1.3.6-04710-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2017-09-15 11:27:24 +02:00
dcb
dccp ipv6/dccp: do not inherit ipv6_mc_list from parent 2017-11-08 05:34:01 -08:00
decnet Import latest Samsung release 2017-04-18 03:43:52 +02:00
dns_resolver
dsa
ethernet
ieee802154
ipc_router net: ipc_router: Remove duplicate client port check 2017-04-22 23:02:47 +02:00
ipv4 tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0 2018-05-26 00:39:34 +02:00
ipv6 Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
ipx ipx: call ipxitf_put() in ioctl error path 2018-01-21 21:05:49 -08:00
irda irda: Fix lockdep annotations in hashbin_delete(). 2017-04-22 23:02:49 +02:00
iucv
key
l2tp This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
lapb
llc net/llc: avoid BUG_ON() in skb_orphan() 2017-04-22 23:03:00 +02:00
mac80211 This is the 3.10.101 stable release 2017-04-18 17:17:55 +02:00
mac802154
netfilter This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
netlabel
netlink netlink: Fix dump skb leak/double free 2017-04-22 23:02:56 +02:00
netrom
nfc
openvswitch openvswitch: fix panic with multiple vlan headers 2014-10-15 08:31:57 +02:00
packet UPSTREAM: packet: hold bind lock when rebinding to fanout hook 2018-05-26 00:39:35 +02:00
phonet This is the 3.10.96 stable release 2017-04-18 17:16:02 +02:00
rds This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
rfkill This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
rmnet_data Merge tag 'LA.BR.1.3.6-05010-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into cm-14.1-merge 2017-11-22 00:26:48 +01:00
rose
rxrpc Import latest Samsung release 2017-04-18 03:43:52 +02:00
sched This is the 3.10.84 stable release 2015-09-30 13:25:40 +05:30
sctp sctp: do not inherit ipv6_{mc|ac|fl}_list from parent 2018-01-21 21:31:35 -08:00
sunrpc This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
tipc net/tipc: initialize security state for new connection socket 2015-10-01 12:07:35 +02:00
unix This is the 3.10.96 stable release 2017-04-18 17:16:02 +02:00
vmw_vsock VSOCK: do not disconnect socket when peer has shutdown SEND only 2016-06-07 10:42:54 +02:00
wimax
wireless nl80211: check for the required netlink attributes presence 2017-10-19 13:01:46 +00:00
x25 net: fix a kernel infoleak in x25 module 2016-06-07 10:42:54 +02:00
xfrm Merge tag 'LA.BR.1.3.6-04710-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2017-09-15 11:27:24 +02:00
activity_stats.c
compat.c net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour 2015-03-26 15:00:56 +01:00
Kconfig
Makefile
nonet.c
socket.c This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
sysctl_net.c