@@ -152,6 +152,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
void *sock_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
+ struct wpa_supplicant *parent = wpa_s->parent;
struct ctrl_iface_priv *priv = sock_ctx;
char buf[4096];
int res;
@@ -208,7 +209,11 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
if (sendto(sock, reply, reply_len, 0, (struct sockaddr *) &from,
fromlen) < 0) {
int _errno = errno;
- wpa_dbg(wpa_s, MSG_DEBUG,
+ /*
+ * Need to use the parent context here as wpa_s might have
+ * been deleted in wpa_supplicant_ctrl_iface_process.
+ */
+ wpa_dbg(parent ? parent : wpa_s, MSG_DEBUG,
"ctrl_iface sendto failed: %d - %s",
_errno, strerror(_errno));
if (_errno == ENOBUFS || _errno == EAGAIN) {
This is needed to not re-use wpa_s after it has been deleted if it is a P2P group interface and the command was P2P_REMOVE_GROUP. Signed-off-by: Toby Gray <toby.gray@realvnc.com> --- wpa_supplicant/ctrl_iface_unix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)