aboutsummaryrefslogtreecommitdiff
path: root/net/ethtool
diff options
context:
space:
mode:
authorJakub Kicinski2022-08-25 20:09:35 -0700
committerPaolo Abeni2022-08-30 12:20:43 +0200
commit4f5059e62921479610de903857857ff82ac7e57f (patch)
tree538e3562c5ab93d0c5b94c86a7b9bb5477fa7013 /net/ethtool
parent08d1d0e78440aa8670492a01cabea732d4beabf5 (diff)
ethtool: report missing header via ext_ack in the default handler
The actual presence check for the header is in ethnl_parse_header_dev_get() but it's a few layers in, and already has a ton of arguments so let's just pick the low hanging fruit and check for missing header in the default request handler. Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/ethtool')
-rw-r--r--net/ethtool/netlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index d5e77f1cbbfa..f4e41a6e0163 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -361,6 +361,9 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
ops = ethnl_default_requests[cmd];
if (WARN_ONCE(!ops, "cmd %u has no ethnl_request_ops\n", cmd))
return -EOPNOTSUPP;
+ if (GENL_REQ_ATTR_CHECK(info, ops->hdr_attr))
+ return -EINVAL;
+
req_info = kzalloc(ops->req_info_size, GFP_KERNEL);
if (!req_info)
return -ENOMEM;