lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230313171500.35400df5@kernel.org>
Date:   Mon, 13 Mar 2023 17:15:00 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Zheng Wang <zyytlz.wz@....com>
Cc:     davem@...emloft.net, simon.horman@...igine.com,
        edumazet@...gle.com, pabeni@...hat.com, petrm@...dia.com,
        thomas.lendacky@....com, wsa+renesas@...g-engineering.com,
        leon@...nel.org, shayagr@...zon.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, hackerzheng666@...il.com,
        1395428693sheep@...il.com, alex000young@...il.com
Subject: Re: [PATCH v2] xirc2ps_cs: Fix use after free bug in xirc2ps_detach

On Sun, 12 Mar 2023 01:08:36 +0800 Zheng Wang wrote:
> 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@....com>
> ---
> v2:
> - fix indentation error suggested by Simon Horman,
> and stop the timeout tasks  suggested by Yunsheng Lin
> ---
>  drivers/net/ethernet/xircom/xirc2ps_cs.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
> index 894e92ef415b..c77ca11d9497 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");
>  

Please fix the formatting and make sure you CC the maintainers when you
post v3.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ