lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2a55yekft.fsf@gmail.com>
Date: Mon, 23 Jun 2025 13:01:10 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net,  netdev@...r.kernel.org,  edumazet@...gle.com,
  pabeni@...hat.com,  andrew+netdev@...n.ch,  horms@...nel.org,
  maxime.chevallier@...tlin.com,  sdf@...ichev.me,  jdamato@...tly.com,
  ecree.xilinx@...il.com
Subject: Re: [PATCH net-next 2/9] net: ethtool: dynamically allocate full
 req size req

Jakub Kicinski <kuba@...nel.org> writes:

> In preparation for using req_info to carry parameters between
> SET and NTF allocate a full request into struct. Since the size

typo: into -> info

> depends on the subcommand we need to allocate it on the heap.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  net/ethtool/netlink.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
> index 9de828df46cd..a9467b96f00c 100644
> --- a/net/ethtool/netlink.c
> +++ b/net/ethtool/netlink.c
> @@ -863,8 +863,8 @@ static int ethnl_default_done(struct netlink_callback *cb)
>  static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
>  {
>  	const struct ethnl_request_ops *ops;
> -	struct ethnl_req_info req_info = {};
>  	const u8 cmd = info->genlhdr->cmd;
> +	struct ethnl_req_info *req_info;
>  	struct net_device *dev;
>  	int ret;
>  
> @@ -874,20 +874,24 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
>  	if (GENL_REQ_ATTR_CHECK(info, ops->hdr_attr))
>  		return -EINVAL;
>  
> -	ret = ethnl_parse_header_dev_get(&req_info, info->attrs[ops->hdr_attr],
> +	req_info = kzalloc(ops->req_info_size, GFP_KERNEL);
> +	if (!req_info)
> +		return -ENOMEM;
> +
> +	ret = ethnl_parse_header_dev_get(req_info, info->attrs[ops->hdr_attr],
>  					 genl_info_net(info), info->extack,
>  					 true);
>  	if (ret < 0)
> -		return ret;
> +		goto out_free_req;
>  
>  	if (ops->set_validate) {
> -		ret = ops->set_validate(&req_info, info);
> +		ret = ops->set_validate(req_info, info);
>  		/* 0 means nothing to do */
>  		if (ret <= 0)
>  			goto out_dev;
>  	}
>  
> -	dev = req_info.dev;
> +	dev = req_info->dev;
>  
>  	rtnl_lock();
>  	netdev_lock_ops(dev);
> @@ -902,7 +906,7 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
>  	if (ret < 0)
>  		goto out_free_cfg;
>  
> -	ret = ops->set(&req_info, info);
> +	ret = ops->set(req_info, info);
>  	if (ret < 0)
>  		goto out_ops;
>  
> @@ -921,7 +925,9 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
>  	netdev_unlock_ops(dev);
>  	rtnl_unlock();
>  out_dev:
> -	ethnl_parse_header_dev_put(&req_info);
> +	ethnl_parse_header_dev_put(req_info);
> +out_free_req:
> +	kfree(req_info);
>  	return ret;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ