[PATCH] Find correct driver for interface additions/removals

Jouni Malinen j at w1.fi
Tue Mar 22 13:12:37 PDT 2016


On Tue, Mar 15, 2016 at 01:02:08PM +0000, Roy Marples wrote:
> To pass the test case, the easiest solution is to add ifindex to the
> returned data, add a function call to the driver to return the ifindex
> and ensure they match (if the driver does infact have the function).
> 
> I ran the test 20 times, and it passed each time.
> Hopefully you can apply the attaced patch now :)
> I will re-submit my interface matching patch shortly as it now needs
> re-factoring slightly.

Thanks, applied with some cleanup and fixes. In particular, this
addition in hostapd was problematic:

> diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
> +void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
> +				 union wpa_event_data *data)

> +	hapd = hostapd_get_iface(interfaces, data->interface_status.ifname);
> +	if (hapd != NULL && hapd->driver->get_ifindex != NULL) {
> +		unsigned int ifindex;
> +
> +		ifindex = hapd->driver->get_ifindex(hapd->drv_priv);

hapd->driver and drv_priv can be NULL here and that results in NULL
pointer dereference either here or in driver_nl80211.c. I added checks
to avoid segfault in such cases (number of hwsim test cases hit this).

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list