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] [day] [month] [year] [list]
Message-ID: <CALs4sv0KUtxAK2vPh5rOsPG5xpBv3tG979V2KL+ncKh7KYsy1g@mail.gmail.com>
Date: Wed, 15 Oct 2025 09:45:23 +0530
From: Pavan Chebbi <pavan.chebbi@...adcom.com>
To: Alexey Simakov <bigalex934@...il.com>
Cc: Michael Chan <mchan@...adcom.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Nithin Nayak Sujir <nsujir@...adcom.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
	lvc-project@...uxtesting.org, Alexandr Sapozhnikov <alsp705@...il.com>
Subject: Re: [PATCH net v2] tg3: prevent use of uninitialized remote_adv and
 local_adv variables

On Tue, Oct 14, 2025 at 10:18 PM Alexey Simakov <bigalex934@...il.com> wrote:
>
> Some execution paths that jump to the fiber_setup_done label
> could leave the remote_adv and local_adv variables uninitialized
> and then use it.
>
> Initialize this variables at the point of definition to avoid this.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 85730a631f0c ("tg3: Add SGMII phy support for 5719/5718 serdes")
> Co-developed-by: Alexandr Sapozhnikov <alsp705@...il.com>
> Signed-off-by: Alexandr Sapozhnikov <alsp705@...il.com>
> Signed-off-by: Alexey Simakov <bigalex934@...il.com>

LGTM.
Reviewed-by: Pavan Chebbi <pavan.chebbi@...adcom.com>

> ---
>
> v2 - remove bogus lines with initialization of variables in function,
> since its initialized at definition point now.
>
> link to v1: https://lore.kernel.org/netdev/20251002091224.11-1-alsp705@gmail.com/
>
>  drivers/net/ethernet/broadcom/tg3.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 7f00ec7fd7b9..d78cafdb2094 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -5803,7 +5803,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)
>         u32 current_speed = SPEED_UNKNOWN;
>         u8 current_duplex = DUPLEX_UNKNOWN;
>         bool current_link_up = false;
> -       u32 local_adv, remote_adv, sgsr;
> +       u32 local_adv = 0, remote_adv = 0, sgsr;
>
>         if ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
>              tg3_asic_rev(tp) == ASIC_REV_5720) &&
> @@ -5944,9 +5944,6 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)
>                 else
>                         current_duplex = DUPLEX_HALF;
>
> -               local_adv = 0;
> -               remote_adv = 0;
> -
>                 if (bmcr & BMCR_ANENABLE) {
>                         u32 common;
>
> --
> 2.34.1

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5469 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ