linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. H. Nikolaus Schaller" <hns@goldelico.com>
To: "John W. Linville" <linville@tuxdriver.com>,
	Bing Zhao <bzhao@marvell.com>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	Dan Williams <dcbw@redhat.com>, Harro Haan <hrhaan@gmail.com>,
	libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Belisko Marek <marek@goldelico.com>,
	NeilBrown Brown <neilb@suse.de>
Subject: [Patch 1/1]: libertas/sdio: fix releasing memory twice.
Date: Sat, 12 Oct 2013 18:02:09 +0200	[thread overview]
Message-ID: <D5BD8103-A6A6-4070-878B-99FC5883725F@goldelico.com> (raw)

[-- 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


             reply	other threads:[~2013-10-12 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12 16:02 Dr. H. Nikolaus Schaller [this message]
2013-10-12 19:58 ` [Patch 1/1]: libertas/sdio: fix releasing memory twice 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D5BD8103-A6A6-4070-878B-99FC5883725F@goldelico.com \
    --to=hns@goldelico.com \
    --cc=bzhao@marvell.com \
    --cc=dcbw@redhat.com \
    --cc=hrhaan@gmail.com \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=marek@goldelico.com \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).