[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABAhCOTs+mBV0M-qEDRCNh51SX_8bFMj9-t45Zz7awcbmxEL1Q@mail.gmail.com>
Date: Tue, 17 Dec 2024 18:33:56 +0800
From: Xiao Liang <shaw.leon@...il.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Cong Wang <cong.wang@...edance.com>, Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v1 net] rtnetlink: Try the outer netns attribute in rtnl_get_peer_net().
On Mon, Dec 16, 2024 at 7:04 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> Xiao Liang reported that the cited commit changed netns handling
> in newlink() of netkit, veth, and vxcan.
>
> Before the patch, if we don't find a netns attribute in the peer
> device attributes, we tried to find another netns attribute in
> the outer netlink attributes by passing it to rtnl_link_get_net().
>
> Let's restore the original behaviour.
>
> Fixes: 48327566769a ("rtnetlink: fix double call of rtnl_link_get_net_ifla()")
> Reported-by: Xiao Liang <shaw.leon@...il.com>
> Closes: https://lore.kernel.org/netdev/CABAhCORBVVU8P6AHcEkENMj+gD2d3ce9t=A_o48E0yOQp8_wUQ@mail.gmail.com/#t
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> net/core/rtnetlink.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index ebcfc2debf1a..d9f959c619d9 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3819,6 +3819,7 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
> }
>
> static struct net *rtnl_get_peer_net(const struct rtnl_link_ops *ops,
> + struct nlattr *tbp[],
> struct nlattr *data[],
> struct netlink_ext_ack *extack)
> {
> @@ -3826,7 +3827,7 @@ static struct net *rtnl_get_peer_net(const struct rtnl_link_ops *ops,
> int err;
>
> if (!data || !data[ops->peer_type])
> - return NULL;
> + return rtnl_link_get_net_ifla(tbp);
>
> err = rtnl_nla_parse_ifinfomsg(tb, data[ops->peer_type], extack);
> if (err < 0)
> @@ -3971,7 +3972,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> }
>
> if (ops->peer_type) {
> - peer_net = rtnl_get_peer_net(ops, data, extack);
> + peer_net = rtnl_get_peer_net(ops, tb, data, extack);
> if (IS_ERR(peer_net)) {
> ret = PTR_ERR(peer_net);
> goto put_ops;
> --
> 2.39.5 (Apple Git-154)
>
Thanks. Tested on my environment, and it's back to the original
behavior now.
Tested-by: Xiao Liang <shaw.leon@...il.com>
Powered by blists - more mailing lists