]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ethtool: don't propagate EOPNOTSUPP from dumps
authorJakub Kicinski <kuba@kernel.org>
Sun, 26 Nov 2023 22:58:06 +0000 (14:58 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 29 Nov 2023 16:43:27 +0000 (08:43 -0800)
The default dump handler needs to clear ret before returning.
Otherwise if the last interface returns an inconsequential
error this error will propagate to user space.

This may confuse user space (ethtool CLI seems to ignore it,
but YNL doesn't). It will also terminate the dump early
for mutli-skb dump, because netlink core treats EOPNOTSUPP
as a real error.

Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20231126225806.2143528-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/netlink.c

index 3bbd5afb7b31cf000f3e4e6ade6542c39456b9e9..fe3553f60bf39e64602d932505a0851e692348a0 100644 (file)
@@ -505,6 +505,7 @@ static int ethnl_default_dumpit(struct sk_buff *skb,
                                ret = skb->len;
                        break;
                }
+               ret = 0;
        }
        rtnl_unlock();