linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 1/1]: libertas/sdio: fix releasing memory twice.
@ 2013-10-12 16:02 Dr. H. Nikolaus Schaller
  2013-10-12 19:58 ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Dr. H. Nikolaus Schaller @ 2013-10-12 16:02 UTC (permalink / raw)
  To: John W. Linville, Bing Zhao, H. Nikolaus Schaller, Dan Williams,
	Harro Haan, libertas-dev, linux-wireless, netdev, LKML,
	Belisko Marek, NeilBrown Brown

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

While upgrading the GTA04 kernel to 3.12-rc4 we came across
an issue with libertas/sdio referencing stale memory on ifconfig up
when trying to load the firmware (for a second time).

I am not at all sure if the patch is how it should be done and the right
location, but it appears to work for us with resetting priv->helper_fw to NULL
before asynchronously loading the firmware again.




[-- Attachment #2: 0001-libertas-sdio-fix-releasing-memory-twice.patch --]
[-- Type: application/octet-stream, Size: 1850 bytes --]

From f6864491ea45d2bd877a37fbb4a618e42fe03fbe Mon Sep 17 00:00:00 2001
From: "H. Nikolaus Schaller" <hns@goldelico.com>
Date: Sat, 12 Oct 2013 17:49:31 +0200
Subject: [PATCH] libertas/sdio: fix releasing memory twice. We have connected
 a Wi2Wi W2CBW003 to an OMAP3 using SDIO. We have seen an
 issue (not related with this patch) that sometimes power is
 not turned off. This did lead to a kernel Oops if an
 ifconfig up / down / up when the chip was not powered down.
 This leads to a second call to lbs_get_firmware_async()
 with the same priv data - and that tries to
 release_firmware(priv->helper_fw); This appears to be
 wrong, since it was alredy released in the
 if_sdio_do_prog_firmware.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/net/wireless/libertas/if_sdio.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 4557833..a04eb41 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -769,6 +769,19 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
 		return 0;
 	}
 
+	/* This is missing in lbs_get_firmware_async()
+	 * and therefore a second call using the same priv structure
+	 * may find a stale helper_fw entry that has already been
+	 * released by release_firmware(helper) in
+	 * if_sdio_do_prog_firmware().
+	 * Or doing that release in if_sdio_do_prog_firmware()
+	 * is a duplicate and should not be there.
+	 * Anyways, this can happen if a ifconfig up / down / up
+	 * sequence is issued.
+	 */
+
+	card->priv->helper_fw = NULL;
+
 	ret = lbs_get_firmware_async(card->priv, &card->func->dev, card->model,
 				     fw_table, if_sdio_do_prog_firmware);
 
-- 
1.7.7.4


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

end of thread, other threads:[~2013-10-14 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12 16:02 [Patch 1/1]: libertas/sdio: fix releasing memory twice Dr. H. Nikolaus Schaller
2013-10-12 19:58 ` Dan Williams
2013-10-13  7:09   ` Dr. H. Nikolaus Schaller
2013-10-14 22:51     ` [PATCH] libertas: move firmware lifetime handling to firmware.c Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).