[patch] don't try to access list members to free them unless already initialised

Jouni Malinen j at w1.fi
Fri Apr 28 08:23:35 PDT 2023


On Fri, Apr 21, 2023 at 10:58:42AM -0400, npiazza at disroot.org wrote:
> taken from openbsd ports, and used by many linux distributions.
> 
> https://github.com/openbsd/ports/blob/master/security/wpa_supplicant/patches/patch-src_utils_eloop_c
> 
> does it make sense to include it in wpa_supplicant?

Probably not unless someone can provide an explanation why that would be
needed.

> Don't try to access list members to free them unless already
> initialised
> 
> Index: src/utils/eloop.c
> @@ -1254,6 +1254,9 @@ void eloop_destroy(void)
>  	struct eloop_timeout *timeout, *prev;
>  	struct os_reltime now;
>  
> +	if (eloop.timeout.prev == NULL)
> +		return;

It is not valid to call eloop_destroy() without having first called
eloop_init() successfully. As such, this condition should never be
reached and should not be needed. If there are applications that do
indeed have eloop.timeout.prev == NULL when eloop_destroy() is being
called, those applications should be fixed instead.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list