Skip to content

Commit fd48f07

Browse files
kuba-mooPaolo Abeni
authored andcommitted
net: don't dump Tx and uninitialized NAPIs
We use NAPI ID as the key for continuing dumps. We also depend on the NAPIs being sorted by ID within the driver list. Tx NAPIs (which don't have an ID assigned) break this expectation, it's not currently possible to dump them reliably. Since Tx NAPIs are relatively rare, and can't be used in doit (GET or SET) hide them from the dump API as well. Fixes: 27f91aa ("netdev-genl: Add netlink framework functions for napi") Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 4c12245 commit fd48f07

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/core/netdev-genl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi,
176176
if (!hdr)
177177
return -EMSGSIZE;
178178

179-
if (napi->napi_id >= MIN_NAPI_ID &&
180-
nla_put_u32(rsp, NETDEV_A_NAPI_ID, napi->napi_id))
179+
if (nla_put_u32(rsp, NETDEV_A_NAPI_ID, napi->napi_id))
181180
goto nla_put_failure;
182181

183182
if (nla_put_u32(rsp, NETDEV_A_NAPI_IFINDEX, napi->dev->ifindex))
@@ -272,6 +271,8 @@ netdev_nl_napi_dump_one(struct net_device *netdev, struct sk_buff *rsp,
272271
return err;
273272

274273
list_for_each_entry(napi, &netdev->napi_list, dev_list) {
274+
if (napi->napi_id < MIN_NAPI_ID)
275+
continue;
275276
if (ctx->napi_id && napi->napi_id >= ctx->napi_id)
276277
continue;
277278

0 commit comments

Comments
 (0)