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: <20240909105822.16362339@wsk>
Date: Mon, 9 Sep 2024 10:58:22 +0200
From: Lukasz Majewski <lukma@...x.de>
To: Jeongjun Park <aha310510@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, horms@...nel.org, ricardo@...liere.net,
 m-karicheri2@...com, n.zhandarovich@...tech.ru, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org,
 syzbot+02a42d9b1bd395cbcab4@...kaller.appspotmail.com
Subject: Re: [PATCH net] net: hsr: prevent NULL pointer dereference in
 hsr_proxy_announce()

Hi Jeongjun,

> In the function hsr_proxy_annouance() added in the previous commit 
> 5f703ce5c981 ("net: hsr: Send supervisory frames to HSR network 
> with ProxyNodeTable data"), the return value of the
> hsr_port_get_hsr() function is not checked to be a NULL pointer,
> which causes a NULL pointer dereference.

Thank you for your patch.

The code in hsr_proxy_announcement() is _only_ executed (the timer is
configured to trigger this function) when hsr->redbox is set, which
means that somebody has called earlier iproute2 command:

ip link add name hsr1 type hsr slave1 lan4 slave2 lan5 interlink lan3
supervision 45 version 1

> 
> To solve this, we need to add code to check whether the return value 
> of hsr_port_get_hsr() is NULL.
> 
> Reported-by: syzbot+02a42d9b1bd395cbcab4@...kaller.appspotmail.com
> Fixes: 5f703ce5c981 ("net: hsr: Send supervisory frames to HSR
> network with ProxyNodeTable data") Signed-off-by: Jeongjun Park
> <aha310510@...il.com> ---
>  net/hsr/hsr_device.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
> index e4cc6b78dcfc..b3191968e53a 100644
> --- a/net/hsr/hsr_device.c
> +++ b/net/hsr/hsr_device.c
> @@ -427,6 +427,9 @@ static void hsr_proxy_announce(struct timer_list
> *t)
>  	 * of SAN nodes stored in ProxyNodeTable.
>  	 */
>  	interlink = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
> +	if (!interlink)
> +		goto done;
> +
>  	list_for_each_entry_rcu(node, &hsr->proxy_node_db, mac_list)
> { if (hsr_addr_is_redbox(hsr, node->macaddress_A))
>  			continue;
> @@ -441,6 +444,7 @@ static void hsr_proxy_announce(struct timer_list
> *t) mod_timer(&hsr->announce_proxy_timer, jiffies + interval);
>  	}
>  
> +done:
>  	rcu_read_unlock();
>  }
>  
> --



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@...x.de

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ