diff mbox series

[net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX

Message ID 20210407064003.248047-1-avagin@gmail.com (mailing list archive)
State Accepted
Commit 7e4a51319d3a71ac8002c96f817bcbeb36789b07
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: introduce nla_policy for IFLA_NEW_IFINDEX | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: christian.brauner@ubuntu.com; 7 maintainers not CCed: laniel_francis@privacyrequired.com zhudi21@huawei.com andrew@lunn.ch cong.wang@bytedance.com nikolay@nvidia.com christian.brauner@ubuntu.com roopa@cumulusnetworks.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Andrei Vagin April 7, 2021, 6:40 a.m. UTC
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(-)

Comments

Jakub Kicinski April 7, 2021, 6:26 p.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org April 7, 2021, 9:50 p.m. UTC | #2
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
diff mbox series

Patch

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;