Re: observed memory leak in wpa_supplicant

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

 



On Wed, 2016-01-27 at 22:06 -0800, Naveen Singh wrote:
> Hi All
> We have been running some stress test of sending a deauth with reason
> code 6 and 7 from an AP to an associated client and monitoring the
> memory usage of wpa_supplicant. In our setup wpa_supplicant talks to
> connman over dbus. Running this stress test reveals memory leak in
> wpa
> supplicant (memory usage of wpa supplicant keeps on growing).
> 
> For connection after getting disconnected connman does "AddNetwork"
> DBUS call to the previously connected SSID. This ends up causing
> memory to be allocated for struct wpa_ssid (os_zalloc called). At
> this
> time there is already a structure allocated for same SSID as a result
> of previous connection. Every connection ends up creating a memory
> which is never freed.
> 
> This surely causes memory usage of wpa_supplicant to go up. Should
> not
> we be allocating memory only if that profile (for that SSID does not
> exist?)

The AddNetwork D-Bus call creates a new network configuration (eg, a
wpa_ssid).  It is the responsibility of the thing calling AddNetwork
(eg, connman) to track what network configurations it has already added
and to remove them when they are no longer in use.

Continuously calling AddNetwork without ever removing networks
previously created with AddNetwork would certainly lead to a memory
leak, but that is mis-use of the supplicant's API.

Connman does call RemoveNetwork when the internal network object is
disconnected, but that can happen in any number of cases.   I'd suggest
filing a bug with the Connman team to see if they can track it down.

Dan

> I am talking about this function:struct wpa_ssid *
> wpa_config_add_network(struct wpa_config *config)
> {
> int id;
> struct wpa_ssid *ssid, *last = NULL;
> 
> id = -1;
> ssid = config->ssid;
> while (ssid) {
>         wpa_printf(MSG_ERROR, "wpa_config_add_network existing ssid
> is
> %p", ssid);
> if (ssid->id > id)
> id = ssid->id;
> last = ssid;
> ssid = ssid->next;
> }
> id++;
> 
> ssid = os_zalloc(sizeof(*ssid));
> if (ssid == NULL)
> return NULL;
> ssid->id = id;
> if (last)
> last->next = ssid;
> else
> config->ssid = ssid;
>         wpa_printf(MSG_ERROR, "wpa_config_add_network added %p size
> %d", ssid, sizeof(*ssid));
> 
> wpa_config_update_prio_list(config);
> 
> return ssid;
> }
> Regards
> 
> _______________________________________________
> Hostap mailing list
> Hostap@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/hostap

_______________________________________________
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