All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wl1251: fix crash on remove due to premature kfree
@ 2012-04-26 20:07 Grazvydas Ignotas
  2012-04-26 20:07 ` [PATCH] wl1251: fix crash on remove due to leftover work item Grazvydas Ignotas
  0 siblings, 1 reply; 2+ messages in thread
From: Grazvydas Ignotas @ 2012-04-26 20:07 UTC (permalink / raw)
  To: John W. Linville; +Cc: Luciano Coelho, linux-wireless, Grazvydas Ignotas

Currently SDIO glue frees it's own structure before calling
wl1251_free_hw(), which in turn calls ieee80211_unregister_hw().
The later call may result in a need to communicate with the chip
to stop it (as it happens now if the interface is still up before
rmmod), which means calls are made back to the glue, resulting in
freed memory access.

Fix this by freeing glue data last.

Cc: stable@vger.kernel.org # v2.6.37+
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/net/wireless/wl1251/sdio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index f786942..1b851f6 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func)
 
 	if (wl->irq)
 		free_irq(wl->irq, wl);
-	kfree(wl_sdio);
 	wl1251_free_hw(wl);
+	kfree(wl_sdio);
 
 	sdio_claim_host(func);
 	sdio_release_irq(func);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] wl1251: fix crash on remove due to leftover work item
  2012-04-26 20:07 [PATCH] wl1251: fix crash on remove due to premature kfree Grazvydas Ignotas
@ 2012-04-26 20:07 ` Grazvydas Ignotas
  0 siblings, 0 replies; 2+ messages in thread
From: Grazvydas Ignotas @ 2012-04-26 20:07 UTC (permalink / raw)
  To: John W. Linville; +Cc: Luciano Coelho, linux-wireless, Grazvydas Ignotas

This driver currently leaves elp_work behind when stopping, which
occasionally results in data corruption because work function ends
up accessing freed memory, typical symptoms of this are various
worker_thread crashes. Fix it by cancelling elp_work.

Cc: stable@vger.kernel.org # v2.6.37+
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/net/wireless/wl1251/main.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index 41302c7..d1afb8e 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
 	cancel_work_sync(&wl->irq_work);
 	cancel_work_sync(&wl->tx_work);
 	cancel_work_sync(&wl->filter_work);
+	cancel_delayed_work_sync(&wl->elp_work);
 
 	mutex_lock(&wl->mutex);
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-26 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 20:07 [PATCH] wl1251: fix crash on remove due to premature kfree Grazvydas Ignotas
2012-04-26 20:07 ` [PATCH] wl1251: fix crash on remove due to leftover work item Grazvydas Ignotas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.