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: <20240709164305.695e5612@kmaincent-XPS-13-7390>
Date: Tue, 9 Jul 2024 16:43:05 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, Oleksij Rempel <o.rempel@...gutronix.de>,
 thomas.petazzoni@...tlin.com, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net] net: ethtool: pse-pd: Fix possible null-deref

On Tue, 9 Jul 2024 07:18:46 -0700
Jakub Kicinski <kuba@...nel.org> wrote:

> > -	if (pse_has_podl(phydev->psec))
> > +	if (tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL])
> >  		config.podl_admin_control =
> > nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
> > -	if (pse_has_c33(phydev->psec))
> > +	if (tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL])
> >  		config.c33_admin_control =
> > nla_get_u32(tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL]); 
> >  	/* Return errno directly - PSE has no notification */  
> 
> At a glance this doesn't follow usual ethtool flow.
> If user doesn't specify a value the previous configuration should be
> kept. We init config to 0. Is 0 a special value for both those params
> which tells drivers "don't change" ?

Mmh in case of a PSE controller supporting PoE or PoDL on its ports, a 0 config
value will return a ENOTSUPP error from the PSE core. We might have an issue in
that case which doesn't exist for now as there is no such controller.

As a PSE port can't be PoE and PoDL maybe the PSE type should be related to the
PSE port and not the full PSE driver.

> Normal ethtool flow is to first fill in the data with a ->get() then
> modify what user wants to change.
> 
> Either we need:
>  - an explanation in the commit message how this keeps old config; or
>  - a ->get() to keep the previous values; or
>  - just reject setting one value but not the other in
>    ethnl_set_pse_validate() (assuming it never worked, anyway).

In fact it is the contrary we can't set both value at the same time because a
PSE port can't be a PoE and a PoDL power interface at the same time.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ