* [PATCH v2] netlink: fixup regression in RTM_GETADDR
@ 2018-12-31 2:10 baloo
2019-01-03 0:16 ` David Ahern
2019-01-04 20:48 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: baloo @ 2018-12-31 2:10 UTC (permalink / raw)
To: netdev; +Cc: Arthur Gautier, David Ahern, David S . Miller
From: Arthur Gautier <baloo@gandi.net>
This commit fixes a regression in AF_INET/RTM_GETADDR and
AF_INET6/RTM_GETADDR.
Before this commit, the kernel would stop dumping addresses once the first
skb was full and end the stream with NLMSG_DONE(-EMSGSIZE). The error
shouldn't be sent back to netlink_dump so the callback is kept alive. The
userspace is expected to call back with a new empty skb.
Changes from V1:
- The error is not handled in netlink_dump anymore but rather in
inet_dump_ifaddr and inet6_dump_addr directly as suggested by
David Ahern.
Fixes: d7e38611b81e ("net/ipv4: Put target net when address dump fails due to bad attributes")
Fixes: 242afaa6968c ("net/ipv6: Put target net when address dump fails due to bad attributes")
Cc: David Ahern <dsahern@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Arthur Gautier <baloo@gandi.net>
---
net/ipv4/devinet.c | 2 +-
net/ipv6/addrconf.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 608a6f4223fb9..fecd0e7672b5d 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1826,7 +1826,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
if (fillargs.netnsid >= 0)
put_net(tgt_net);
- return err < 0 ? err : skb->len;
+ return skb->len ? : err;
}
static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 045597b9a7c05..e3cb53b0ef670 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5154,7 +5154,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
if (fillargs.netnsid >= 0)
put_net(tgt_net);
- return err < 0 ? err : skb->len;
+ return skb->len ? : err;
}
static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] netlink: fixup regression in RTM_GETADDR
2018-12-31 2:10 [PATCH v2] netlink: fixup regression in RTM_GETADDR baloo
@ 2019-01-03 0:16 ` David Ahern
2019-01-04 20:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2019-01-03 0:16 UTC (permalink / raw)
To: baloo, netdev; +Cc: David S . Miller
On 12/30/18 7:10 PM, baloo@gandi.net wrote:
> From: Arthur Gautier <baloo@gandi.net>
>
> This commit fixes a regression in AF_INET/RTM_GETADDR and
> AF_INET6/RTM_GETADDR.
>
> Before this commit, the kernel would stop dumping addresses once the first
> skb was full and end the stream with NLMSG_DONE(-EMSGSIZE). The error
> shouldn't be sent back to netlink_dump so the callback is kept alive. The
> userspace is expected to call back with a new empty skb.
>
> Changes from V1:
> - The error is not handled in netlink_dump anymore but rather in
> inet_dump_ifaddr and inet6_dump_addr directly as suggested by
> David Ahern.
>
> Fixes: d7e38611b81e ("net/ipv4: Put target net when address dump fails due to bad attributes")
> Fixes: 242afaa6968c ("net/ipv6: Put target net when address dump fails due to bad attributes")
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: "David S . Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Arthur Gautier <baloo@gandi.net>
> ---
> net/ipv4/devinet.c | 2 +-
> net/ipv6/addrconf.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 608a6f4223fb9..fecd0e7672b5d 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -1826,7 +1826,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
> if (fillargs.netnsid >= 0)
> put_net(tgt_net);
>
> - return err < 0 ? err : skb->len;
> + return skb->len ? : err;
> }
>
> static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 045597b9a7c05..e3cb53b0ef670 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -5154,7 +5154,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
> if (fillargs.netnsid >= 0)
> put_net(tgt_net);
>
> - return err < 0 ? err : skb->len;
> + return skb->len ? : err;
> }
>
> static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
>
That looks correct. The only error for in_dev_dump_addr is -EMSGSIZE and
that should not be returned. The other errors happen with skb->len == 0.
Same with the ipv6 version.
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] netlink: fixup regression in RTM_GETADDR
2018-12-31 2:10 [PATCH v2] netlink: fixup regression in RTM_GETADDR baloo
2019-01-03 0:16 ` David Ahern
@ 2019-01-04 20:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-01-04 20:48 UTC (permalink / raw)
To: baloo; +Cc: netdev, dsahern
From: baloo@gandi.net
Date: Mon, 31 Dec 2018 02:10:58 +0000
> From: Arthur Gautier <baloo@gandi.net>
>
> This commit fixes a regression in AF_INET/RTM_GETADDR and
> AF_INET6/RTM_GETADDR.
>
> Before this commit, the kernel would stop dumping addresses once the first
> skb was full and end the stream with NLMSG_DONE(-EMSGSIZE). The error
> shouldn't be sent back to netlink_dump so the callback is kept alive. The
> userspace is expected to call back with a new empty skb.
>
> Changes from V1:
> - The error is not handled in netlink_dump anymore but rather in
> inet_dump_ifaddr and inet6_dump_addr directly as suggested by
> David Ahern.
>
> Fixes: d7e38611b81e ("net/ipv4: Put target net when address dump fails due to bad attributes")
> Fixes: 242afaa6968c ("net/ipv6: Put target net when address dump fails due to bad attributes")
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: "David S . Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Arthur Gautier <baloo@gandi.net>
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-04 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-31 2:10 [PATCH v2] netlink: fixup regression in RTM_GETADDR baloo
2019-01-03 0:16 ` David Ahern
2019-01-04 20:48 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.