Skip to content

Commit e8d20c3

Browse files
bluesheep1337davem330
authored andcommitted
xirc2ps_cs: Fix use after free bug in xirc2ps_detach
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>
1 parent 25143b6 commit e8d20c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/xircom/xirc2ps_cs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@ static void
503503
xirc2ps_detach(struct pcmcia_device *link)
504504
{
505505
struct net_device *dev = link->priv;
506+
struct local_info *local = netdev_priv(dev);
507+
508+
netif_carrier_off(dev);
509+
netif_tx_disable(dev);
510+
cancel_work_sync(&local->tx_timeout_task);
506511

507512
dev_dbg(&link->dev, "detach\n");
508513

0 commit comments

Comments
 (0)