[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220826030935.2165661-7-kuba@kernel.org>
Date: Thu, 25 Aug 2022 20:09:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
mkubecek@...e.cz, johannes@...solutions.net, idosch@...sch.org,
dsahern@...il.com, stephen@...workplumber.org,
Jakub Kicinski <kuba@...nel.org>,
Ido Schimmel <idosch@...dia.com>
Subject: [PATCH net-next v3 6/6] 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@...dia.com>
Reviewed-by: Johannes Berg <johannes@...solutions.net>
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
v3: s/handing/hanging/
---
net/ethtool/netlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index e26079e11835..0ccb177aaf04 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;
--
2.37.2
Powered by blists - more mailing lists