mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
xirc2ps_cs: Fix use after free bug in xirc2ps_detach
[ Upstream commite8d20c3ded] 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:1da177e4c3("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
39c3b9dd48
commit
bfeeb3aaad
@@ -503,6 +503,11 @@ static void
|
|||||||
xirc2ps_detach(struct pcmcia_device *link)
|
xirc2ps_detach(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
struct net_device *dev = link->priv;
|
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");
|
dev_dbg(&link->dev, "detach\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user