[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230526204956.4cc0ddf3@kernel.org>
Date: Fri, 26 May 2023 20:49:56 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Xin Long <lucien.xin@...il.com>
Cc: network dev <netdev@...r.kernel.org>, davem@...emloft.net, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Thomas Graf
<tgraf@...radead.org>, Alexander Duyck <alexanderduyck@...com>
Subject: Re: [PATCH net 1/3] rtnetlink: move validate_linkmsg into
rtnl_create_link
On Thu, 25 May 2023 17:49:15 -0400 Xin Long wrote:
> In commit 644c7eebbfd5 ("rtnetlink: validate attributes in do_setlink()"),
> it moved validate_linkmsg() from rtnl_setlink() to do_setlink(). However,
> as validate_linkmsg() is also called in __rtnl_newlink(), it caused
> validate_linkmsg() being called twice when running 'ip link set'.
>
> The validate_linkmsg() was introduced by commit 1840bb13c22f5b ("[RTNL]:
> Validate hardware and broadcast address attribute for RTM_NEWLINK") for
> existing links. After adding it in do_setlink(), there's no need to call
> it in __rtnl_newlink().
>
> Instead of deleting it from __rtnl_newlink(), this patch moves it to
> rtnl_create_link() to fix the missing validation for the new created
> links.
>
> Fixes: 644c7eebbfd5 ("rtnetlink: validate attributes in do_setlink()")
I don't see any bug in here, is there one? Or you're just trying
to avoid calling validation twice? I think it's better to validate
twice than validate after some changes have already been applied
by __rtnl_newlink()... If we really care about the double validation
we should pull the validation out of do_setlink(), IMHO.
--
pw-bot: cr
Powered by blists - more mailing lists