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: <ZtYJX2HTeiglkxUU@LQ3V64L9R2.station>
Date: Mon, 2 Sep 2024 20:52:15 +0200
From: Joe Damato <jdamato@...tly.com>
To: netdev@...r.kernel.org
Cc: mkarsten@...terloo.ca, Amritha Nambiar <amritha.nambiar@...el.com>,
	stable@...nel.org, Jakub Kicinski <kuba@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Sridhar Samudrala <sridhar.samudrala@...el.com>,
	Stanislav Fomichev <sdf@...ichev.me>,
	Daniel Jurgens <danielj@...dia.com>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] netdev-genl: Set extack and fix error on napi-get

On Sat, Aug 31, 2024 at 12:17:04PM +0000, Joe Damato wrote:
> In commit 27f91aaf49b3 ("netdev-genl: Add netlink framework functions
> for napi"), when an invalid NAPI ID is specified the return value
> -EINVAL is used and no extack is set.
> 
> Change the return value to -ENOENT and set the extack.
> 
> Before this commit:
> 
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
>                           --do napi-get --json='{"id": 451}'
> Netlink error: Invalid argument
> nl_len = 36 (20) nl_flags = 0x100 nl_type = 2
> 	error: -22
> 
> After this commit:
> 
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
>                          --do napi-get --json='{"id": 451}'
> Netlink error: No such file or directory
> nl_len = 44 (28) nl_flags = 0x300 nl_type = 2
> 	error: -2
> 	extack: {'bad-attr': '.id'}
> 
> Cc: Amritha Nambiar <amritha.nambiar@...el.com>
> Cc: stable@...nel.org
> Suggested-by: Jakub Kicinski <kuba@...nel.org>
> Fixes: 27f91aaf49b3 ("netdev-genl: Add netlink framework functions for napi")
> Signed-off-by: Joe Damato <jdamato@...tly.com>
> ---
>  net/core/netdev-genl.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index 05f9515d2c05..a17d7eaeb001 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -216,10 +216,12 @@ int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
>  	rtnl_lock();
>  
>  	napi = napi_by_id(napi_id);
> -	if (napi)
> +	if (napi) {
>  		err = netdev_nl_napi_fill_one(rsp, napi, info);
> -	else
> -		err = -EINVAL;
> +	} else {
> +		NL_SET_BAD_ATTR(info->extack, info->attrs[NETDEV_A_NAPI_ID]);
> +		err = -ENOENT;
> +	}
>  
>  	rtnl_unlock();
>  
> -- 
> 2.25.1

Based on Eric's comment regarding my other patch [1], I should
probably re-submit this against net-next instead of net.

It's been over 48 hours, but I'll wait a bit longer before
resubmitting.

[1]: https://lore.kernel.org/all/CANn89iLhrKyFKf9DpJSSM9CZ9sgoRo7jovg2GhjsJABoqzzVsQ@mail.gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ