From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: ioana.ciornei@nxp.com, davem@davemloft.net, kuba@kernel.org,
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: Mon, 15 Nov 2021 11:08:17 +0300 [thread overview]
Message-ID: <20211115080817.GE27562@kadam> (raw)
In-Reply-To: <20211113172013.19959-1-paskripkin@gmail.com>
On Sat, Nov 13, 2021 at 08:20:13PM +0300, Pavel Skripkin wrote:
> Access to netdev after free_netdev() will cause use-after-free bug.
> Move debug log before free_netdev() call to avoid it.
>
> Cc: stable@vger.kernel.org # v4.19+
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
>
> Note about Fixes: tag. The commit introduced it was before this driver
> was moved out from staging. I guess, Fixes tag cannot be used here.
> Please, let me know if I am wrong.
>
You should still use the Fixes tag.
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
>
> @Dan, is there a smatch checker for straigthforward use after free bugs?
> Like acessing pointer after free was called? I think, adding
> free_netdev() to check list might be good idea
>
> I've skimmed througth smatch source and didn't find one, so can you,
> please, point out to it if it exists.
It's check_free_strict.c.
It does cross function analysis but free_netdev() is tricky because it
doesn't free directly, it just drops the reference count. Also it
delays freeing in the NETREG_UNREGISTERING path so this check might
cause false positives? I'll add free_netdev() to the list of free
functions and test it overnight tonight.
register_free_hook("free_netdev", &match_free, 0);
regards,
dan carpenter
next prev parent reply other threads:[~2021-11-15 8:09 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 [this message]
2021-11-16 1:27 ` Jakub Kicinski
2021-11-16 4:16 ` Pavel Skripkin
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=20211115080817.GE27562@kadam \
--to=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=paskripkin@gmail.com \
--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).