From: David Miller <davem@davemloft.net>
To: alexey.kodanev@oracle.com
Cc: netdev@vger.kernel.org, gfree.wind@vip.163.com
Subject: Re: [PATCH net] macvlan: fix use-after-free in macvlan_common_newlink()
Date: Fri, 23 Feb 2018 10:48:47 -0500 (EST) [thread overview]
Message-ID: <20180223.104847.2086352429829171963.davem@davemloft.net> (raw)
In-Reply-To: <1519312830-5601-1-git-send-email-alexey.kodanev@oracle.com>
From: Alexey Kodanev <alexey.kodanev@oracle.com>
Date: Thu, 22 Feb 2018 18:20:30 +0300
> The following use-after-free was reported by KASan when running
> LTP macvtap01 test on 4.16-rc2:
...
> Commit d02fd6e7d293 ("macvlan: Fix one possible double free") handles
> the case when register_netdevice() invokes ndo_uninit() on error and
> as a result free the port. But 'macvlan_port_get_rtnl(dev))' check
> (returns dev->rx_handler_data), which was added by this commit in order
> to prevent double free, is not quite correct:
>
> * for macvlan it always returns NULL because 'lowerdev' is the one that
> was used to register rx handler (port) in macvlan_port_create() as
> well as to unregister it in macvlan_port_destroy().
> * for macvtap it always returns a valid pointer because macvtap registers
> its own rx handler before macvlan_common_newlink().
>
> Fixes: d02fd6e7d293 ("macvlan: Fix one possible double free")
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Applied and queued up for -stable, thanks Alexey.
prev parent reply other threads:[~2018-02-23 15:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 15:20 [PATCH net] macvlan: fix use-after-free in macvlan_common_newlink() Alexey Kodanev
2018-02-23 15:48 ` David Miller [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=20180223.104847.2086352429829171963.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=alexey.kodanev@oracle.com \
--cc=gfree.wind@vip.163.com \
--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;
as well as URLs for NNTP newsgroup(s).