From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@mellanox.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
Vlad Yasevich <vyasevich@gmail.com>
Subject: Re: [PATCH net] rtnetlink: Disallow FDB configuration for non-Ethernet device
Date: Sun, 28 Oct 2018 15:37:38 -0600 [thread overview]
Message-ID: <03983d49-664a-12d6-ede4-e16a37af4563@gmail.com> (raw)
In-Reply-To: <20181027203819.7333-1-idosch@mellanox.com>
On 10/27/18 2:39 PM, Ido Schimmel wrote:
> When an FDB entry is configured, the address is validated to have the
> length of an Ethernet address, but the device for which the address is
> configured can be of any type.
>
> The above can result in the use of uninitialized memory when the address
> is later compared against existing addresses since 'dev->addr_len' is
> used and it may be greater than ETH_ALEN, as with ip6tnl devices.
>
> Fix this by making sure that FDB entries are only configured for
> Ethernet devices.
...
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index f679c7a7d761..728a97f9f700 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3600,6 +3600,11 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
> return -EINVAL;
> }
>
> + if (dev->type != ARPHRD_ETHER) {
> + NL_SET_ERR_MSG(extack, "invalid device type");
If only Ethernet devices are supported, then the error message can be
more specific: "FDB add only support for Ethernet devices"
> + return -EINVAL;
> + }
> +
> addr = nla_data(tb[NDA_LLADDR]);
>
> err = fdb_vid_parse(tb[NDA_VLAN], &vid, extack);
> @@ -3704,6 +3709,11 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
> return -EINVAL;
> }
>
> + if (dev->type != ARPHRD_ETHER) {
> + NL_SET_ERR_MSG(extack, "invalid device type");
same here.
> + return -EINVAL;
> + }
> +
> addr = nla_data(tb[NDA_LLADDR]);
>
> err = fdb_vid_parse(tb[NDA_VLAN], &vid, extack);
>
prev parent reply other threads:[~2018-10-29 6:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-27 20:39 [PATCH net] rtnetlink: Disallow FDB configuration for non-Ethernet device Ido Schimmel
2018-10-28 21:37 ` David Ahern [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=03983d49-664a-12d6-ede4-e16a37af4563@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=vyasevich@gmail.com \
/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