[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200825082437.GQ5493@kadam>
Date: Tue, 25 Aug 2020 11:24:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net] net: read dev->needs_free_netdev before potentially
freeing dev
On Mon, Aug 24, 2020 at 10:06:50PM +0200, Jason A. Donenfeld wrote:
> If dev->needs_free_netdev is true, it means that netdev_run_todo should
> call free_netdev(dev) after it calls dev->priv_destructor. If
> dev->needs_free_netdev is false, then it means that either
> dev->priv_destructor is taking care of calling free_netdev(dev), or
> something else, elsewhere, is doing that. In this case, branching on
> "if (dev->needs_free_netdev)" after calling dev->priv_destructor is a
> potential UaF. This patch fixes the issue by reading
> dev->needs_free_netdev before calling dev->priv_destructor.
>
No, I misread the code. Sorry. This patch is not required. We can
use "dev" up to the end of the function where we do:
/* Free network device */
kobject_put(&dev->dev.kobj);
That's where the final reference is released.
regards,
dan carpenter
Powered by blists - more mailing lists