diff mbox

[1/1] nl80211_deinit cancel blocked rfkill timeout

Message ID 1398473163-16612-1-git-send-email-eduardo.abinader@openbossa.org
State Accepted
Headers show

Commit Message

Eduardo Abinader April 26, 2014, 12:46 a.m. UTC
Got segfault, when freeing drv and there exists registered
timeout for blocked rfkill. This patch adds cancel timeout
for blocked rfkill.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
---
 src/drivers/driver_nl80211.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jouni Malinen April 29, 2014, 5:52 p.m. UTC | #1
On Fri, Apr 25, 2014 at 08:46:03PM -0400, Eduardo Abinader wrote:
> Got segfault, when freeing drv and there exists registered
> timeout for blocked rfkill. This patch adds cancel timeout
> for blocked rfkill.

Thanks, applied.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -4819,6 +4819,10 @@ static void wpa_driver_nl80211_deinit(struct i802_bss *bss)
> +	if (rfkill_is_blocked(drv->rfkill))
> +		eloop_cancel_timeout(wpa_driver_nl80211_send_rfkill, drv, drv->ctx);

Though, I dropped that if (rfkill_is_blocked) part since it is fine to
call eloop_cancel_timeout() without anything matching and that timeout
must not be left behind regardless of what has happened with rfkill
since the drv pointer is freed immediately after this.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1300703..396a937 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4819,6 +4819,10 @@  static void wpa_driver_nl80211_deinit(struct i802_bss *bss)
 
 	netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
 			       IF_OPER_UP);
+
+	if (rfkill_is_blocked(drv->rfkill))
+		eloop_cancel_timeout(wpa_driver_nl80211_send_rfkill, drv, drv->ctx);
+
 	rfkill_deinit(drv->rfkill);
 
 	eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);