Re: [PATCH v5 01/17] mesh: factor out mesh join function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 29, 2018 at 02:39:05PM -0700, peter.oh@xxxxxxxxxxxxxxxxx wrote:
> mesh join function consitss of 2 parts which are preparing
> configurations and sending join event to driver.
> Since physical mesh join event could happen either right
> after mesh configuration is done or after CAC is done
> in case of DFS channel is used, factor out the function
> into 2 parts to reduce redundant calls.

This leaks memory:

> +void wpas_join_mesh(struct wpa_supplicant *wpa_s)
> +{
> +	struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;

Nothing frees wpa_s->mesh_params here or anywhere else. This needs to
get freed somewhere both in success and failure cases.

>  int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
>  			     struct wpa_ssid *ssid)
>  {
> -	struct wpa_driver_mesh_join_params params;
> +	struct wpa_driver_mesh_join_params *params =
> +		os_zalloc(sizeof(struct wpa_driver_mesh_join_params));

This is where the allocation happens.

> -	if (wpa_supplicant_mesh_init(wpa_s, ssid, &params.freq)) {
> +	wpa_s->mesh_params = params;
> +	if (wpa_supplicant_mesh_init(wpa_s, ssid, &params->freq)) {

And this sets wpa_s->mesh_params overriding the previous (potentially
unfreed) pointer.

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux