1
0
Fork 0
alistair23-linux/drivers/net/wan
Xie He bf0ffea336 net: hdlc_x25: Prevent racing between "x25_close" and "x25_xmit"/"x25_rx"
"x25_close" is called by "hdlc_close" in "hdlc.c", which is called by
hardware drivers' "ndo_stop" function.
"x25_xmit" is called by "hdlc_start_xmit" in "hdlc.c", which is hardware
drivers' "ndo_start_xmit" function.
"x25_rx" is called by "hdlc_rcv" in "hdlc.c", which receives HDLC frames
from "net/core/dev.c".

"x25_close" races with "x25_xmit" and "x25_rx" because their callers race.

However, we need to ensure that the LAPB APIs called in "x25_xmit" and
"x25_rx" are called before "lapb_unregister" is called in "x25_close".

This patch adds locking to ensure when "x25_xmit" and "x25_rx" are doing
their work, "lapb_unregister" is not yet called in "x25_close".

Reasons for not solving the racing between "x25_close" and "x25_xmit" by
calling "netif_tx_disable" in "x25_close":
1. We still need to solve the racing between "x25_close" and "x25_rx";
2. The design of the HDLC subsystem assumes the HDLC hardware drivers
have full control over the TX queue, and the HDLC protocol drivers (like
this driver) have no control. Controlling the queue here in the protocol
driver may interfere with hardware drivers' control of the queue.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-15 12:18:58 -07:00
..
lmc net: wan/lmc: dont print format string when not available 2021-02-15 13:03:22 -08:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Kconfig wan: ds26522: select CONFIG_BITREVERSE 2021-01-05 15:50:36 -08:00
Makefile net: wan: Delete the DLCI / SDLA drivers 2020-11-17 13:33:29 -08:00
c101.c WAN: Replace HTTP links with HTTPS ones 2020-07-13 16:58:01 -07:00
cosa.c cosa: Add missing kfree in error path of cosa_write 2020-11-11 17:52:01 -08:00
cosa.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
farsync.c net: wan: farsync: use new tasklet API 2021-02-06 12:00:02 -08:00
farsync.h WAN: Replace zero-length array with flexible-array member 2020-02-27 12:06:55 -08:00
fsl_ucc_hdlc.c net: wan: fix error return code of uhdlc_init() 2021-03-08 11:56:40 -08:00
fsl_ucc_hdlc.h net/wan/fsl_ucc_hdlc: avoid use of IS_ERR_VALUE() 2019-12-09 13:57:45 -06:00
hd64570.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hd64570.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hd64572.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hd64572.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hdlc.c net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device 2020-10-21 17:20:19 -07:00
hdlc_cisco.c drivers/net/wan/hdlc: Set skb->protocol before transmitting 2020-09-17 16:41:12 -07:00
hdlc_fr.c net: hdlc_fr: Add support for any Ethertype 2020-11-03 15:19:21 -08:00
hdlc_ppp.c net: hdlc_ppp: Fix issues when mod_timer is called while timer is running 2020-12-28 15:09:04 -08:00
hdlc_raw.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_raw_eth.c net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup 2020-10-21 17:58:26 -07:00
hdlc_x25.c net: hdlc_x25: Prevent racing between "x25_close" and "x25_xmit"/"x25_rx" 2021-03-15 12:18:58 -07:00
hostess_sv11.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ixp4xx_hss.c net: wan: Use DEFINE_SPINLOCK() for spinlock 2021-01-05 15:43:41 -08:00
lapbether.c net: lapbether: Remove netif_start_queue / netif_stop_queue 2021-03-09 11:03:09 -08:00
n2.c WAN: Replace HTTP links with HTTPS ones 2020-07-13 16:58:01 -07:00
pc300too.c WAN: Replace HTTP links with HTTPS ones 2020-07-13 16:58:01 -07:00
pci200syn.c net: wan: remove trailing semicolon in macro definition 2020-11-30 18:58:31 -08:00
sbni.c net: wan: Replace simple_strtol by simple_strtoul 2021-01-05 15:43:41 -08:00
sbni.h
sealevel.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
slic_ds26522.c net: wan: slic_ds26522: Remove unused macro DRV_NAME 2020-08-31 12:40:42 -07:00
slic_ds26522.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
wanxl.c wan: wanxl: switch from 'pci_' to 'dma_' API 2020-08-04 16:17:00 -07:00
wanxl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
wanxlfw.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
wanxlfw.inc_shipped
z85230.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
z85230.h Remove every trace of SERIAL_MAGIC 2019-11-13 19:01:14 +08:00