* net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
@ 2026-09-14 14:21 Quentin Armitage
2026-09-14 15:27 ` Ido Schimmel
2026-09-14 17:21 ` Jakub Kicinski
0 siblings, 2 replies; 7+ messages in thread
From: Quentin Armitage @ 2026-09-14 14:21 UTC (permalink / raw)
To: David Ahern, Ido Schimmel; +Cc: netdev
Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly" changed
inet_validate_link_af() to call nla_parse_nested() rather than
nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is that
the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and rejects the
message if it is not, whereas previously there was no check for NLA_F_NESTED
being set.
The consequence of this is that code which worked prior to Linux 7.1, albeit
erroneously not setting NLA_F_NESTED now fails.
In order to maintain backward compatibility, rather than calling
nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it is
earlier in the function.
FWIW the following patch makes the change.
commit 5f372809f2f07fe7ed5b91b4293945e8a7fd343b
Author: Quentin Armitage <quentin@armitage.org.uk>
Date: Mon Sep 14 15:10:42 2026 +0100
net: allow IFLA_INET_CONF messages when NLA_F_NESTED unset
Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly"
added validation of IFLA_INET_CONF attributes, and in the process
changed the call of nla_for_each_nested() to nla_parse_nested(). A
side effect of this change is that the IFLA_INET_CONF option is now
tested for NLA_F_NESTED being set, and fails if it is not. Prior to the
commit there was no check of NLA_F_NESTED.
Changing nla_parse_nested() to nla_parse_nested_decrecated() restores
the previous functionality of not checking for NLA_F_NESTED, thereby
allowing code that (incorrectly) doesn't set NLA_F_NESTED to continue to
work.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index a90be57c63be..2bb7b1c7565e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2117,9 +2117,10 @@ static int inet_validate_link_af(const struct net_device
*dev,
return err;
if (tb[IFLA_INET_CONF]) {
- err = nla_parse_nested(nested_tb, IPV4_DEVCONF_MAX,
- tb[IFLA_INET_CONF], inet_devconf_policy,
- extack);
+ err = nla_parse_nested_deprecated(nested_tb, IPV4_DEVCONF_MAX,
+ tb[IFLA_INET_CONF],
+ inet_devconf_policy,
+ extack);
if (err < 0)
return err;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 14:21 net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set Quentin Armitage
@ 2026-09-14 15:27 ` Ido Schimmel
2026-09-14 15:42 ` Ido Schimmel
2026-09-14 17:21 ` Jakub Kicinski
1 sibling, 1 reply; 7+ messages in thread
From: Ido Schimmel @ 2026-09-14 15:27 UTC (permalink / raw)
To: Quentin Armitage; +Cc: David Ahern, netdev
On Mon, Sep 14, 2026 at 03:21:59PM +0100, Quentin Armitage wrote:
> Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly" changed
> inet_validate_link_af() to call nla_parse_nested() rather than
> nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is that
> the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and rejects the
> message if it is not, whereas previously there was no check for NLA_F_NESTED
> being set.
>
> The consequence of this is that code which worked prior to Linux 7.1, albeit
> erroneously not setting NLA_F_NESTED now fails.
>
> In order to maintain backward compatibility, rather than calling
> nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it is
> earlier in the function.
I don't think nla_parse_nested_deprecated() is safe. It will allow
attributes exceeding the maximum type or with type 0, which can then
crash in inet_set_link_af(). Can you try nla_parse_deprecated_strict()
instead?
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index a90be57c63be..4e0e153f504f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2117,10 +2117,10 @@ static int inet_validate_link_af(const struct net_device *dev,
return err;
if (tb[IFLA_INET_CONF]) {
- err = nla_parse_nested(nested_tb, IPV4_DEVCONF_MAX,
- tb[IFLA_INET_CONF], inet_devconf_policy,
- extack);
-
+ err = nla_parse_deprecated_strict(nested_tb, IPV4_DEVCONF_MAX,
+ nla_data(tb[IFLA_INET_CONF]),
+ nla_len(tb[IFLA_INET_CONF]),
+ inet_devconf_policy, extack);
if (err < 0)
return err;
}
>
> FWIW the following patch makes the change.
>
> commit 5f372809f2f07fe7ed5b91b4293945e8a7fd343b
> Author: Quentin Armitage <quentin@armitage.org.uk>
> Date: Mon Sep 14 15:10:42 2026 +0100
>
> net: allow IFLA_INET_CONF messages when NLA_F_NESTED unset
>
> Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly"
Proper way to cite a commit (I believe checkpatch flags it):
Commit fa8fca88714c ("ipv4: validate IPV4_DEVCONF attributes properly")
> added validation of IFLA_INET_CONF attributes, and in the process
> changed the call of nla_for_each_nested() to nla_parse_nested(). A
> side effect of this change is that the IFLA_INET_CONF option is now
> tested for NLA_F_NESTED being set, and fails if it is not. Prior to the
> commit there was no check of NLA_F_NESTED.
>
> Changing nla_parse_nested() to nla_parse_nested_decrecated() restores
Use imperative mood: Change nla_parse_nested() ...
> the previous functionality of not checking for NLA_F_NESTED, thereby
> allowing code that (incorrectly) doesn't set NLA_F_NESTED to continue to
> work.
>
Missing a Fixes tag:
Fixes: fa8fca88714c ("ipv4: validate IPV4_DEVCONF attributes properly")
Please read:
https://docs.kernel.org/next/process/maintainer-netdev.html
Before submitting formally.
> Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Thanks
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 15:27 ` Ido Schimmel
@ 2026-09-14 15:42 ` Ido Schimmel
0 siblings, 0 replies; 7+ messages in thread
From: Ido Schimmel @ 2026-09-14 15:42 UTC (permalink / raw)
To: Quentin Armitage; +Cc: David Ahern, netdev
On Mon, Sep 14, 2026 at 06:27:21PM +0300, Ido Schimmel wrote:
> On Mon, Sep 14, 2026 at 03:21:59PM +0100, Quentin Armitage wrote:
> > Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly" changed
> > inet_validate_link_af() to call nla_parse_nested() rather than
> > nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is that
> > the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and rejects the
> > message if it is not, whereas previously there was no check for NLA_F_NESTED
> > being set.
> >
> > The consequence of this is that code which worked prior to Linux 7.1, albeit
> > erroneously not setting NLA_F_NESTED now fails.
> >
> > In order to maintain backward compatibility, rather than calling
> > nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it is
> > earlier in the function.
>
> I don't think nla_parse_nested_deprecated() is safe. It will allow
> attributes exceeding the maximum type or with type 0, which can then
> crash in inet_set_link_af(). Can you try nla_parse_deprecated_strict()
> instead?
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index a90be57c63be..4e0e153f504f 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2117,10 +2117,10 @@ static int inet_validate_link_af(const struct net_device *dev,
> return err;
>
> if (tb[IFLA_INET_CONF]) {
> - err = nla_parse_nested(nested_tb, IPV4_DEVCONF_MAX,
> - tb[IFLA_INET_CONF], inet_devconf_policy,
> - extack);
> -
> + err = nla_parse_deprecated_strict(nested_tb, IPV4_DEVCONF_MAX,
> + nla_data(tb[IFLA_INET_CONF]),
> + nla_len(tb[IFLA_INET_CONF]),
> + inet_devconf_policy, extack);
> if (err < 0)
> return err;
> }
Actually, nla_parse() would be closer to what is currently in the tree
and should still fix the breakage:
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index a90be57c63be..1f747826542a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2117,10 +2117,10 @@ static int inet_validate_link_af(const struct net_device *dev,
return err;
if (tb[IFLA_INET_CONF]) {
- err = nla_parse_nested(nested_tb, IPV4_DEVCONF_MAX,
- tb[IFLA_INET_CONF], inet_devconf_policy,
- extack);
-
+ err = nla_parse(nested_tb, IPV4_DEVCONF_MAX,
+ nla_data(tb[IFLA_INET_CONF]),
+ nla_len(tb[IFLA_INET_CONF]),
+ inet_devconf_policy, extack);
if (err < 0)
return err;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 14:21 net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set Quentin Armitage
2026-09-14 15:27 ` Ido Schimmel
@ 2026-09-14 17:21 ` Jakub Kicinski
2026-09-14 17:43 ` Ido Schimmel
1 sibling, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-09-14 17:21 UTC (permalink / raw)
To: Quentin Armitage; +Cc: David Ahern, Ido Schimmel, netdev
On Mon, 14 Sep 2026 15:21:59 +0100 Quentin Armitage wrote:
> Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly" changed
> inet_validate_link_af() to call nla_parse_nested() rather than
> nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is that
> the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and rejects the
> message if it is not, whereas previously there was no check for NLA_F_NESTED
> being set.
>
> The consequence of this is that code which worked prior to Linux 7.1, albeit
> erroneously not setting NLA_F_NESTED now fails.
>
> In order to maintain backward compatibility, rather than calling
> nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it is
> earlier in the function.
Please explain how you discovered the problem.
Is there some open source or closed source SW you're aware of which
breaks?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 17:21 ` Jakub Kicinski
@ 2026-09-14 17:43 ` Ido Schimmel
2026-09-14 17:51 ` Jakub Kicinski
2026-09-14 17:52 ` Quentin Armitage
0 siblings, 2 replies; 7+ messages in thread
From: Ido Schimmel @ 2026-09-14 17:43 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: Quentin Armitage, David Ahern, netdev
On Mon, Sep 14, 2026 at 10:21:08AM -0700, Jakub Kicinski wrote:
> On Mon, 14 Sep 2026 15:21:59 +0100 Quentin Armitage wrote:
> > Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly" changed
> > inet_validate_link_af() to call nla_parse_nested() rather than
> > nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is that
> > the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and rejects the
> > message if it is not, whereas previously there was no check for NLA_F_NESTED
> > being set.
> >
> > The consequence of this is that code which worked prior to Linux 7.1, albeit
> > erroneously not setting NLA_F_NESTED now fails.
> >
> > In order to maintain backward compatibility, rather than calling
> > nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it is
> > earlier in the function.
>
> Please explain how you discovered the problem.
> Is there some open source or closed source SW you're aware of which
> breaks?
FWIW, I sent a patch to keepalived in the past and I remember Quentin
from there. It seems to be affected:
https://github.com/acassen/keepalived/blob/6d6194307e11a3d55870633fe00a50b56db7e3b8/keepalived/vrrp/vrrp_if_config.c#L172
https://github.com/acassen/keepalived/blob/6d6194307e11a3d55870633fe00a50b56db7e3b8/keepalived/vrrp/vrrp_if_config.c#L210
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 17:43 ` Ido Schimmel
@ 2026-09-14 17:51 ` Jakub Kicinski
2026-09-14 17:52 ` Quentin Armitage
1 sibling, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2026-09-14 17:51 UTC (permalink / raw)
To: Ido Schimmel; +Cc: Quentin Armitage, David Ahern, netdev
On Mon, 14 Sep 2026 20:43:07 +0300 Ido Schimmel wrote:
> > Please explain how you discovered the problem.
> > Is there some open source or closed source SW you're aware of which
> > breaks?
>
> FWIW, I sent a patch to keepalived in the past and I remember Quentin
> from there. It seems to be affected:
Ah, thanks! I was (of course) worried it's an AI report :S
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set
2026-09-14 17:43 ` Ido Schimmel
2026-09-14 17:51 ` Jakub Kicinski
@ 2026-09-14 17:52 ` Quentin Armitage
1 sibling, 0 replies; 7+ messages in thread
From: Quentin Armitage @ 2026-09-14 17:52 UTC (permalink / raw)
To: Ido Schimmel, Jakub Kicinski; +Cc: David Ahern, netdev
On Mon, 2026-09-14 at 20:43 +0300, Ido Schimmel wrote:
> On Mon, Sep 14, 2026 at 10:21:08AM -0700, Jakub Kicinski wrote:
> > On Mon, 14 Sep 2026 15:21:59 +0100 Quentin Armitage wrote:
> > > Commit fa8fca88714c - "ipv4: validate IPV4_DEVCONF attributes properly"
> > > changed
> > > inet_validate_link_af() to call nla_parse_nested() rather than
> > > nla_for_each_nested() for IFLA_INET_CONF. A side effect of this change is
> > > that
> > > the code now checks that NLA_F_NESTED is set for IFLA_INET_CONF, and
> > > rejects the
> > > message if it is not, whereas previously there was no check for
> > > NLA_F_NESTED
> > > being set.
> > >
> > > The consequence of this is that code which worked prior to Linux 7.1,
> > > albeit
> > > erroneously not setting NLA_F_NESTED now fails.
> > >
> > > In order to maintain backward compatibility, rather than calling
> > > nla_parse_nested(), nla_parse_nested_deprecated() should be called, as it
> > > is
> > > earlier in the function.
> >
> > Please explain how you discovered the problem.
> > Is there some open source or closed source SW you're aware of which
> > breaks?
>
> FWIW, I sent a patch to keepalived in the past and I remember Quentin
> from there. It seems to be affected:
>
> https://github.com/acassen/keepalived/blob/6d6194307e11a3d55870633fe00a50b56db7e3b8/keepalived/vrrp/vrrp_if_config.c#L172
> https://github.com/acassen/keepalived/blob/6d6194307e11a3d55870633fe00a50b56db7e3b8/keepalived/vrrp/vrrp_if_config.c#L210
Yes, that is spot on. I noticed that keepalived
(https://github.com/acassen/keepalived) was reporting an error when it was
configuring macvlan interfaces on v7.1 that hadn't been occurring on earlier
kernels.
I will merge a patch for keepalived later today, so that nest_start() in
vrrp_if_config.c sets the NFA_F_NESTED flag. I have verified that this resolves
the problem.
If it is thought better not to modify the kernel but just update keepalived,
then so be it. However, it will mean that all existing versions of keepalived
will fail to function correctly on v7.1+ kernels.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-09-14 17:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 14:21 net: parsing IFLA_INET_CONF broken since 7.1 if NLA_F_NESTED not set Quentin Armitage
2026-09-14 15:27 ` Ido Schimmel
2026-09-14 15:42 ` Ido Schimmel
2026-09-14 17:21 ` Jakub Kicinski
2026-09-14 17:43 ` Ido Schimmel
2026-09-14 17:51 ` Jakub Kicinski
2026-09-14 17:52 ` Quentin Armitage
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox