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: <20220401104342.5df7349a@kernel.org>
Date:   Fri, 1 Apr 2022 10:43:42 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Florent Fourcot <florent.fourcot@...irst.fr>
Cc:     netdev@...r.kernel.org, cong.wang@...edance.com,
        edumazet@...gle.com, Jiri Pirko <jiri@...lanox.com>,
        Brian Baboch <brian.baboch@...irst.fr>
Subject: Re: [PATCH net v2] rtnetlink: enable alt_ifname for setlink/newlink

On Fri,  1 Apr 2022 17:39:39 +0200 Florent Fourcot wrote:
> buffer called "ifname" given in function rtnl_dev_get
> is always valid when called by setlink/newlink,
> but contains only empty string when IFLA_IFNAME is not given. So
> IFLA_ALT_IFNAME is always ignored
> 
> This patch fixes rtnl_dev_get function with a remove of ifname argument,
> and move ifname copy in do_setlink when required
> 
> Changes in v2:
>  * Remove ifname argument in rtnl_dev_get/do_setlink
>    functions (simplify code)
> 
> Fixes: 76c9ac0ee878 ("net: rtnetlink: add possibility to use alternative names as message handle")
> CC: Jiri Pirko <jiri@...lanox.com>
> Signed-off-by: Florent Fourcot <florent.fourcot@...irst.fr>
> Signed-off-by: Brian Baboch <brian.baboch@...irst.fr>

> @@ -3262,7 +3257,7 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
>  
>  	for_each_netdev_safe(net, dev, aux) {
>  		if (dev->group == group) {
> -			err = do_setlink(skb, dev, ifm, extack, tb, NULL, 0);
> +			err = do_setlink(skb, dev, ifm, extack, tb, 0);

This part depends on your other change, right? Do you care about this
getting into stable? Otherwise we can downgrade it from a fix to -next
and merge after your other patch. It never worked so we can go either
way on it being a fix. Actually leaning slightly towards it _not_ being
a fix.

>  			if (err < 0)
>  				return err;
>  		}

> @@ -3450,7 +3440,10 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
>  	if (!ops->alloc && !ops->setup)
>  		return -EOPNOTSUPP;
>  
> -	if (!ifname[0]) {
> +	if (tb[IFLA_IFNAME]) {
> +		nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
> +	}
> +	else {

Formatting slightly off here, should be

	} else {

>  		snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
>  		name_assign_type = NET_NAME_ENUM;
>  	}
> @@ -3622,8 +3615,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr *nlh,
>  	if (ifm->ifi_index > 0)
>  		dev = __dev_get_by_index(tgt_net, ifm->ifi_index);
>  	else if (tb[IFLA_IFNAME] || tb[IFLA_ALT_IFNAME])
> -		dev = rtnl_dev_get(tgt_net, tb[IFLA_IFNAME],
> -				   tb[IFLA_ALT_IFNAME], NULL);
> +		dev = rtnl_dev_get(tgt_net, tb[IFLA_IFNAME], tb[IFLA_ALT_IFNAME]);

How about we pass tb and extract IFLA_IFNAME and IFLA_ALT_IFNAME inside
rtnl_dev_get()? All callers seem to pass the same args now.

>  	else
>  		goto out;
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ