linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] wireless: ath9k-htc: fix possible use after free
@ 2012-09-13  2:33 Ming Lei
  2012-09-27  4:06 ` Ming Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2012-09-13  2:33 UTC (permalink / raw)
  To: linux-wireless
  Cc: Ming Lei, ath9k-devel, Luis R. Rodriguez, Jouni Malinen,
	Vasanthakumar Thiagarajan, Senthil Balasubramanian,
	John W. Linville

Inside ath9k_hif_usb_firmware_fail(), the instance of
'struct struct hif_device_usb' may be freed by
ath9k_hif_usb_disconnect() after

	complete(&hif_dev->fw_done);

But 'hif_dev' is still accessed after the line code
above is executed.

This patch fixes the issue by not accessing 'hif_dev'
after 'complete(&hif_dev->fw_done)' inside
ath9k_hif_usb_firmware_fail().

Cc: ath9k-devel@lists.ath9k.org
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
Cc: Jouni Malinen <jouni@qca.qualcomm.com>
Cc: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index ee6e50a..924c461 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1072,14 +1072,15 @@ static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev)
  */
 static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev)
 {
-	struct device *parent = hif_dev->udev->dev.parent;
+	struct device *dev = &hif_dev->udev->dev;
+	struct device *parent = dev->parent;
 
 	complete(&hif_dev->fw_done);
 
 	if (parent)
 		device_lock(parent);
 
-	device_release_driver(&hif_dev->udev->dev);
+	device_release_driver(dev);
 
 	if (parent)
 		device_unlock(parent);
-- 
1.7.9.5


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

* Re: [PATCH -next] wireless: ath9k-htc: fix possible use after free
  2012-09-13  2:33 [PATCH -next] wireless: ath9k-htc: fix possible use after free Ming Lei
@ 2012-09-27  4:06 ` Ming Lei
  2012-09-27 21:24   ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2012-09-27  4:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: Ming Lei, ath9k-devel, Luis R. Rodriguez, Jouni Malinen,
	Vasanthakumar Thiagarajan, Senthil Balasubramanian,
	John W. Linville

On Thu, Sep 13, 2012 at 10:33 AM, Ming Lei <ming.lei@canonical.com> wrote:
> Inside ath9k_hif_usb_firmware_fail(), the instance of
> 'struct struct hif_device_usb' may be freed by
> ath9k_hif_usb_disconnect() after
>
>         complete(&hif_dev->fw_done);
>
> But 'hif_dev' is still accessed after the line code
> above is executed.
>
> This patch fixes the issue by not accessing 'hif_dev'
> after 'complete(&hif_dev->fw_done)' inside
> ath9k_hif_usb_firmware_fail().
>
> Cc: ath9k-devel@lists.ath9k.org
> Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
> Cc: Jouni Malinen <jouni@qca.qualcomm.com>
> Cc: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
> Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
> Cc: "John W. Linville" <linville@tuxdriver.com>

Gentle ping, :-)

Thanks,
--
Ming Lei

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

* Re: [PATCH -next] wireless: ath9k-htc: fix possible use after free
  2012-09-27  4:06 ` Ming Lei
@ 2012-09-27 21:24   ` John W. Linville
  0 siblings, 0 replies; 3+ messages in thread
From: John W. Linville @ 2012-09-27 21:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez, Jouni Malinen,
	Vasanthakumar Thiagarajan, Senthil Balasubramanian

On Thu, Sep 27, 2012 at 12:06:17PM +0800, Ming Lei wrote:
> On Thu, Sep 13, 2012 at 10:33 AM, Ming Lei <ming.lei@canonical.com> wrote:
> > Inside ath9k_hif_usb_firmware_fail(), the instance of
> > 'struct struct hif_device_usb' may be freed by
> > ath9k_hif_usb_disconnect() after
> >
> >         complete(&hif_dev->fw_done);
> >
> > But 'hif_dev' is still accessed after the line code
> > above is executed.
> >
> > This patch fixes the issue by not accessing 'hif_dev'
> > after 'complete(&hif_dev->fw_done)' inside
> > ath9k_hif_usb_firmware_fail().
> >
> > Cc: ath9k-devel@lists.ath9k.org
> > Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
> > Cc: Jouni Malinen <jouni@qca.qualcomm.com>
> > Cc: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
> > Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
> > Cc: "John W. Linville" <linville@tuxdriver.com>
> 
> Gentle ping, :-)

This is commit e962610f8100e1b52973f5a9c855cbc3d1ba04ec in wireless-next?

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

end of thread, other threads:[~2012-09-27 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13  2:33 [PATCH -next] wireless: ath9k-htc: fix possible use after free Ming Lei
2012-09-27  4:06 ` Ming Lei
2012-09-27 21:24   ` John W. Linville

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).