Skip to content

Commit 4a25201

Browse files
committed
netdev-genl: avoid empty messages in napi get
Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down we "hide" the NAPI instances. Fixes: 27f91aa ("netdev-genl: Add netlink framework functions for napi") Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 246068b commit 4a25201

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/core/netdev-genl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,12 @@ int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
246246
rcu_read_unlock();
247247
rtnl_unlock();
248248

249-
if (err)
249+
if (err) {
250+
goto err_free_msg;
251+
} else if (!rsp->len) {
252+
err = -ENOENT;
250253
goto err_free_msg;
254+
}
251255

252256
return genlmsg_reply(rsp, info);
253257

0 commit comments

Comments
 (0)