linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iwlegacy: fix bugs in change_interface
@ 2011-03-29 12:05 Johannes Berg
  2011-03-29 13:22 ` Stanislaw Gruszka
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2011-03-29 12:05 UTC (permalink / raw)
  To: John Linville; +Cc: Stanislaw Gruszka, linux-wireless

From: Johannes Berg <johannes.berg@intel.com>

If change_interface gets invoked during a firmware
restart, it may crash; prevent that from happening
by checking if ctx->vif is assigned.

Additionally, in my initial commit I forgot to set
the vif->p2p variable correctly, so fix that too,
even if it doesn't matter since P2P isn't supported.

Cc: stable@kernel.org [2.6.38+]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/iwlegacy/iwl-core.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/net/wireless/iwlegacy/iwl-core.c	2011-03-29 14:04:06.000000000 +0200
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c	2011-03-29 14:04:42.000000000 +0200
@@ -1805,6 +1805,15 @@ iwl_legacy_mac_change_interface(struct i
 
 	mutex_lock(&priv->mutex);
 
+	if (!ctx->vif) {
+		/*
+		 * Huh? But wait ... this can maybe happen when
+		 * we're in the middle of a firmware restart!
+		 */
+		err = -EBUSY;
+		goto out;
+	}
+
 	interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
 
 	if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1841,7 @@ iwl_legacy_mac_change_interface(struct i
 	/* success */
 	iwl_legacy_teardown_interface(priv, vif, true);
 	vif->type = newtype;
+	vif->p2p = newp2p;
 	err = iwl_legacy_setup_interface(priv, ctx);
 	WARN_ON(err);
 	/*



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

* Re: [PATCH] iwlegacy: fix bugs in change_interface
  2011-03-29 12:05 [PATCH] iwlegacy: fix bugs in change_interface Johannes Berg
@ 2011-03-29 13:22 ` Stanislaw Gruszka
  2011-03-29 13:26   ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Gruszka @ 2011-03-29 13:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless

On Tue, Mar 29, 2011 at 02:05:59PM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> If change_interface gets invoked during a firmware
> restart, it may crash; prevent that from happening
> by checking if ctx->vif is assigned.
> 
> Additionally, in my initial commit I forgot to set
> the vif->p2p variable correctly, so fix that too,
> even if it doesn't matter since P2P isn't supported.

ACK

Does we also need iwl_{legacy,}is_ready_rf check?

Stanislaw

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

* Re: [PATCH] iwlegacy: fix bugs in change_interface
  2011-03-29 13:22 ` Stanislaw Gruszka
@ 2011-03-29 13:26   ` Johannes Berg
  2011-03-29 13:28     ` [PATCH v2] " Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2011-03-29 13:26 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: John Linville, linux-wireless

On Tue, 2011-03-29 at 15:22 +0200, Stanislaw Gruszka wrote:
> On Tue, Mar 29, 2011 at 02:05:59PM +0200, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > If change_interface gets invoked during a firmware
> > restart, it may crash; prevent that from happening
> > by checking if ctx->vif is assigned.
> > 
> > Additionally, in my initial commit I forgot to set
> > the vif->p2p variable correctly, so fix that too,
> > even if it doesn't matter since P2P isn't supported.
> 
> ACK
> 
> Does we also need iwl_{legacy,}is_ready_rf check?

Good question, I guess it wouldn't hurt.

FWIW, I'm submitting the iwlagn version (which looks just the same) to
our own testing first.

johannes


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

* [PATCH v2] iwlegacy: fix bugs in change_interface
  2011-03-29 13:26   ` Johannes Berg
@ 2011-03-29 13:28     ` Johannes Berg
  2011-03-29 14:28       ` Stanislaw Gruszka
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2011-03-29 13:28 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: John Linville, linux-wireless

From: Johannes Berg <johannes.berg@intel.com>

If change_interface gets invoked during a firmware
restart, it may crash; prevent that from happening
by checking if ctx->vif is assigned.

Additionally, in my initial commit I forgot to set
the vif->p2p variable correctly, so fix that too.

Cc: stable@kernel.org [2.6.38+]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/iwlegacy/iwl-core.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/net/wireless/iwlegacy/iwl-core.c	2011-03-29 14:04:06.000000000 +0200
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c	2011-03-29 15:27:21.000000000 +0200
@@ -1805,6 +1805,15 @@ iwl_legacy_mac_change_interface(struct i
 
 	mutex_lock(&priv->mutex);
 
+	if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) {
+		/*
+		 * Huh? But wait ... this can maybe happen when
+		 * we're in the middle of a firmware restart!
+		 */
+		err = -EBUSY;
+		goto out;
+	}
+
 	interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
 
 	if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1841,7 @@ iwl_legacy_mac_change_interface(struct i
 	/* success */
 	iwl_legacy_teardown_interface(priv, vif, true);
 	vif->type = newtype;
+	vif->p2p = newp2p;
 	err = iwl_legacy_setup_interface(priv, ctx);
 	WARN_ON(err);
 	/*



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

* Re: [PATCH v2] iwlegacy: fix bugs in change_interface
  2011-03-29 13:28     ` [PATCH v2] " Johannes Berg
@ 2011-03-29 14:28       ` Stanislaw Gruszka
  0 siblings, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2011-03-29 14:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless

On Tue, Mar 29, 2011 at 03:28:11PM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> If change_interface gets invoked during a firmware
> restart, it may crash; prevent that from happening
> by checking if ctx->vif is assigned.
> 
> Additionally, in my initial commit I forgot to set
> the vif->p2p variable correctly, so fix that too.
> 
> Cc: stable@kernel.org [2.6.38+]
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

ACK

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

end of thread, other threads:[~2011-03-29 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 12:05 [PATCH] iwlegacy: fix bugs in change_interface Johannes Berg
2011-03-29 13:22 ` Stanislaw Gruszka
2011-03-29 13:26   ` Johannes Berg
2011-03-29 13:28     ` [PATCH v2] " Johannes Berg
2011-03-29 14:28       ` Stanislaw Gruszka

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