Fix DHCP/NDISC snoop deinit followed by failing re-init

It was possible to hit a double-free on the l2_packet socket if
initialization of DHCP/NDISC snoop failed on a hostapd interface that
had previously had those enabled successfully. Fix this by clearing the
l2_packet pointers during deinit.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-03-04 11:42:15 +02:00
parent 6baab31c6c
commit d4359923e1
2 changed files with 2 additions and 0 deletions

View file

@ -154,4 +154,5 @@ int dhcp_snoop_init(struct hostapd_data *hapd)
void dhcp_snoop_deinit(struct hostapd_data *hapd) void dhcp_snoop_deinit(struct hostapd_data *hapd)
{ {
l2_packet_deinit(hapd->sock_dhcp); l2_packet_deinit(hapd->sock_dhcp);
hapd->sock_dhcp = NULL;
} }

View file

@ -182,4 +182,5 @@ int ndisc_snoop_init(struct hostapd_data *hapd)
void ndisc_snoop_deinit(struct hostapd_data *hapd) void ndisc_snoop_deinit(struct hostapd_data *hapd)
{ {
l2_packet_deinit(hapd->sock_ndisc); l2_packet_deinit(hapd->sock_ndisc);
hapd->sock_ndisc = NULL;
} }