From: Pavel Skripkin <paskripkin@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>
Cc: ioana.ciornei@nxp.com, davem@davemloft.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] net: dpaa2-eth: fix use-after-free in dpaa2_eth_remove
Date: Tue, 16 Nov 2021 07:16:49 +0300 [thread overview]
Message-ID: <0e94dae1-dd77-861d-1e13-856cb1b145d2@gmail.com> (raw)
In-Reply-To: <20211115172722.6a582623@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 11/16/21 04:27, Jakub Kicinski wrote:
> I'd ignore that path, it's just special casing that's supposed to keep
> the driver-visible API sane. Nobody should be touching netdev past
> free_netdev(). Actually if you can it'd be interesting to add checks
> for using whatever netdev_priv(ndev) returned past free_netdev(ndev).
>
> Most UAFs that come to mind from the past were people doing something
> like:
>
> struct my_priv *mine = netdev_priv(ndev);
>
> netdev_unregister(ndev);
> free_netdev(ndev);
>
> free(mine->bla); /* UAF, free_netdev() frees the priv */
>
I've implemented this checker couple of months ago. The latest smatch
(v1.72) should warn about this type of bugs. All reported bugs are fixed
already :)
My checker warns about using priv pointer after free_netdev() and
free_candev() calls. There are a few more wrappers like
free_sja1000dev(), so it worth to add them to check list too. Will add
them today later
Important thing, that there are complex situations like
struct priv *priv = get_priv_from_smth(smth);
free_netdev(priv->netdev);
clean_up_priv(priv);
and for now I have no idea how to handle it (ex: ems_usb_disconnect).
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-11-16 5:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 17:20 [PATCH] net: dpaa2-eth: fix use-after-free in dpaa2_eth_remove Pavel Skripkin
2021-11-15 8:08 ` Dan Carpenter
2021-11-16 1:27 ` Jakub Kicinski
2021-11-16 4:16 ` Pavel Skripkin [this message]
2021-11-16 15:17 ` [PATCH v2] " Pavel Skripkin
2021-11-17 14:50 ` patchwork-bot+netdevbpf
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=0e94dae1-dd77-861d-1e13-856cb1b145d2@gmail.com \
--to=paskripkin@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).