Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX
@ 2021-04-07  6:40 Andrei Vagin
  2021-04-07 18:26 ` Jakub Kicinski
  2021-04-07 21:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Vagin @ 2021-04-07  6:40 UTC (permalink / raw)
  To: Jakub Kicinski, David S. Miller, netdev; +Cc: Andrei Vagin

In this case, we don't need to check that new_ifindex is positive in
validate_linkmsg.

Fixes: eeb85a14ee34 ("net: Allow to specify ifindex when device is moved to another namespace")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 net/core/rtnetlink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d51252afde0a..9108a7e6c0c0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1877,6 +1877,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
 				    .len = ALTIFNAMSIZ - 1 },
 	[IFLA_PERM_ADDRESS]	= { .type = NLA_REJECT },
 	[IFLA_PROTO_DOWN_REASON] = { .type = NLA_NESTED },
+	[IFLA_NEW_IFINDEX]	= NLA_POLICY_MIN(NLA_S32, 1),
 };
 
 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
@@ -2266,9 +2267,6 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
 			return -EINVAL;
 	}
 
-	if (tb[IFLA_NEW_IFINDEX] && nla_get_s32(tb[IFLA_NEW_IFINDEX]) <= 0)
-		return -EINVAL;
-
 	if (tb[IFLA_AF_SPEC]) {
 		struct nlattr *af;
 		int rem, err;
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX
  2021-04-07  6:40 [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX Andrei Vagin
@ 2021-04-07 18:26 ` Jakub Kicinski
  2021-04-07 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-04-07 18:26 UTC (permalink / raw)
  To: Andrei Vagin; +Cc: David S. Miller, netdev

On Tue,  6 Apr 2021 23:40:03 -0700 Andrei Vagin wrote:
> In this case, we don't need to check that new_ifindex is positive in
> validate_linkmsg.
> 
> Fixes: eeb85a14ee34 ("net: Allow to specify ifindex when device is moved to another namespace")
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX
  2021-04-07  6:40 [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX Andrei Vagin
  2021-04-07 18:26 ` Jakub Kicinski
@ 2021-04-07 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-07 21:50 UTC (permalink / raw)
  To: Andrei Vagin; +Cc: kuba, davem, netdev

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue,  6 Apr 2021 23:40:03 -0700 you wrote:
> In this case, we don't need to check that new_ifindex is positive in
> validate_linkmsg.
> 
> Fixes: eeb85a14ee34 ("net: Allow to specify ifindex when device is moved to another namespace")
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX
    https://git.kernel.org/netdev/net-next/c/7e4a51319d3a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  6:40 [PATCH net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX Andrei Vagin
2021-04-07 18:26 ` Jakub Kicinski
2021-04-07 21:50 ` patchwork-bot+netdevbpf

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git