aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/xircom
diff options
context:
space:
mode:
authorZheng Wang2023-03-17 00:15:26 +0800
committerGreg Kroah-Hartman2023-03-30 12:49:04 +0200
commit9d882229d365f68f74028252261ab14a8de7faed (patch)
tree0f32e2779653fb0b272e44dde8d2772e6e1b5e04 /drivers/net/ethernet/xircom
parent97ea704f39b5ded96f071e98701aa543f6f89683 (diff)
xirc2ps_cs: Fix use after free bug in xirc2ps_detach
[ Upstream commit e8d20c3ded59a092532513c9bd030d1ea66f5f44 ] In xirc2ps_probe, the local->tx_timeout_task was bounded with xirc2ps_tx_timeout_task. When timeout occurs, it will call xirc_tx_timeout->schedule_work to start the work. When we call xirc2ps_detach to remove the driver, there may be a sequence as follows: Stop responding to timeout tasks and complete scheduled tasks before cleanup in xirc2ps_detach, which will fix the problem. CPU0 CPU1 |xirc2ps_tx_timeout_task xirc2ps_detach | free_netdev | kfree(dev); | | | do_reset | //use dev Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/xircom')
-rw-r--r--drivers/net/ethernet/xircom/xirc2ps_cs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
index 894e92ef415b..9f505cf02d96 100644
--- a/drivers/net/ethernet/xircom/xirc2ps_cs.c
+++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c
@@ -503,6 +503,11 @@ static void
xirc2ps_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
+ struct local_info *local = netdev_priv(dev);
+
+ netif_carrier_off(dev);
+ netif_tx_disable(dev);
+ cancel_work_sync(&local->tx_timeout_task);
dev_dbg(&link->dev, "detach\n");