From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] net: read dev->needs_free_netdev before potentially freeing dev
Date: Tue, 25 Aug 2020 11:24:37 +0300 [thread overview]
Message-ID: <20200825082437.GQ5493@kadam> (raw)
In-Reply-To: <20200824200650.21982-1-Jason@zx2c4.com>
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
prev parent reply other threads:[~2020-08-25 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200824141519.GA223008@mwanda>
2020-08-24 19:52 ` [bug report] net: WireGuard secure network tunnel Jason A. Donenfeld
2020-08-24 20:06 ` [PATCH net] net: read dev->needs_free_netdev before potentially freeing dev Jason A. Donenfeld
2020-08-24 20:35 ` Jason A. Donenfeld
2020-08-25 8:24 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200825082437.GQ5493@kadam \
--to=dan.carpenter@oracle.com \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox