netdev-genl: fix error codes when outputting XDP features
BugLink: https://bugs.launchpad.net/bugs/2075154
[ Upstream commit 7ed352d34f1a09a7659c53de07785115587499fe ]
-EINVAL will interrupt the dump. The correct error to return
if we have more data to dump is -EMSGSIZE.
Discovered by doing:
for i in `seq 80`; do ip link add type veth; done
./cli.py --dbg-small-recv 5300 --spec netdev.yaml --dump dev-get >> /dev/null
[...]
nl_len = 64 (48) nl_flags = 0x0 nl_type = 19
nl_len = 20 (4) nl_flags = 0x2 nl_type = 3
error: -22
Fixes: d3d854fd6a ("netdev-genl: create a simple family for netdev stuff")
Reviewed-by: Amritha Nambiar <amritha.nambiar@intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240613213044.3675745-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Roxana Nicolescu
parent
e9e0235742
commit
5cc5309f93
@@ -58,22 +58,22 @@ XDP_METADATA_KFUNC_xxx
|
||||
nla_put_u64_64bit(rsp, NETDEV_A_DEV_XDP_RX_METADATA_FEATURES,
|
||||
xdp_rx_meta, NETDEV_A_DEV_PAD) ||
|
||||
nla_put_u64_64bit(rsp, NETDEV_A_DEV_XSK_FEATURES,
|
||||
xsk_features, NETDEV_A_DEV_PAD)) {
|
||||
genlmsg_cancel(rsp, hdr);
|
||||
return -EINVAL;
|
||||
}
|
||||
xsk_features, NETDEV_A_DEV_PAD))
|
||||
goto err_cancel_msg;
|
||||
|
||||
if (netdev->xdp_features & NETDEV_XDP_ACT_XSK_ZEROCOPY) {
|
||||
if (nla_put_u32(rsp, NETDEV_A_DEV_XDP_ZC_MAX_SEGS,
|
||||
netdev->xdp_zc_max_segs)) {
|
||||
genlmsg_cancel(rsp, hdr);
|
||||
return -EINVAL;
|
||||
}
|
||||
netdev->xdp_zc_max_segs))
|
||||
goto err_cancel_msg;
|
||||
}
|
||||
|
||||
genlmsg_end(rsp, hdr);
|
||||
|
||||
return 0;
|
||||
|
||||
err_cancel_msg:
|
||||
genlmsg_cancel(rsp, hdr);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user