summaryrefslogtreecommitdiff
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2021-04-28 13:22:54 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2021-04-28 13:22:54 +0200
commitb230f517500e6dc358ba65dafb4a6ed18449500e (patch)
tree7eebcca8ddb0ff9ee971698616c11219cba43ca4 /net/sctp/socket.c
parentf5978a07daf67b25d101caa42ab3b18f0edf3dde (diff)
parent47127fcd287c91397d11bcf697d12c79169528f2 (diff)
Merge 4.4.268 into android-4.4-p
Changes in 4.4.268 net/sctp: fix race condition in sctp_destroy_sock Input: nspire-keypad - enable interrupts only when opened dmaengine: dw: Make it dependent to HAS_IOMEM ARM: dts: Fix moving mmc devices with aliases for omap4 & 5 arc: kernel: Return -EFAULT if copy_to_user() fails neighbour: Disregard DEAD dst in neigh_update ARM: keystone: fix integer overflow warning ASoC: fsl_esai: Fix TDM slot setup for I2S mode net: ieee802154: stop dump llsec keys for monitors net: ieee802154: stop dump llsec devs for monitors net: ieee802154: forbid monitor for add llsec dev net: ieee802154: stop dump llsec devkeys for monitors net: ieee802154: forbid monitor for add llsec devkey net: ieee802154: stop dump llsec seclevels for monitors net: ieee802154: forbid monitor for add llsec seclevel pcnet32: Use pci_resource_len to validate PCI resource Input: i8042 - fix Pegatron C15B ID entry scsi: libsas: Reset num_scatter if libata marks qc as NODATA net: davicom: Fix regulator not turned off on failed probe i40e: fix the panic when running bpf in xdpdrv mode ARM: 9071/1: uprobes: Don't hook on thumb instructions net: hso: fix null-ptr-deref during tty device unregistration ext4: correct error label in ext4_rename() ARM: dts: Fix swapped mmc order for omap3 s390/entry: save the caller of psw_idle xen-netback: Check for hotplug-status existence before watching cavium/liquidio: Fix duplicate argument ia64: fix discontig.c section mismatches ia64: tools: remove duplicate definition of ia64_mf() on ia64 compiler.h: enable builtin overflow checkers and add fallback code overflow.h: Add allocation size calculation helpers x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access net: hso: fix NULL-deref on disconnect regression Linux 4.4.268 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I98c94e88153f3a181e39ce6eed3c983c356d5b94
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 62ba9a49c126..405dc1863b30 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1567,11 +1567,9 @@ static void sctp_close(struct sock *sk, long timeout)
/* Supposedly, no process has access to the socket, but
* the net layers still may.
- * Also, sctp_destroy_sock() needs to be called with addr_wq_lock
- * held and that should be grabbed before socket lock.
*/
- spin_lock_bh(&net->sctp.addr_wq_lock);
- bh_lock_sock_nested(sk);
+ local_bh_disable();
+ bh_lock_sock(sk);
/* Hold the sock, since sk_common_release() will put sock_put()
* and we have just a little more cleanup.
@@ -1580,7 +1578,7 @@ static void sctp_close(struct sock *sk, long timeout)
sk_common_release(sk);
bh_unlock_sock(sk);
- spin_unlock_bh(&net->sctp.addr_wq_lock);
+ local_bh_enable();
sock_put(sk);
@@ -4161,9 +4159,6 @@ static int sctp_init_sock(struct sock *sk)
sk_sockets_allocated_inc(sk);
sock_prot_inuse_add(net, sk->sk_prot, 1);
- /* Nothing can fail after this block, otherwise
- * sctp_destroy_sock() will be called without addr_wq_lock held
- */
if (net->sctp.default_auto_asconf) {
spin_lock(&sock_net(sk)->sctp.addr_wq_lock);
list_add_tail(&sp->auto_asconf_list,
@@ -4198,7 +4193,9 @@ static void sctp_destroy_sock(struct sock *sk)
if (sp->do_auto_asconf) {
sp->do_auto_asconf = 0;
+ spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock);
list_del(&sp->auto_asconf_list);
+ spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock);
}
sctp_endpoint_free(sp->ep);
local_bh_disable();