Skip to content

Commit

Permalink
iwl3945: fix possible il->txq NULL pointer dereference in delayed works
Browse files Browse the repository at this point in the history
commit 210787e upstream.

On il3945_down procedure we free tx queue data and nullify il->txq
pointer. After that we drop mutex and then cancel delayed works. There
is possibility, that after drooping mutex and before the cancel, some
delayed work will start and crash while trying to send commands to
the device. For example, here is reported crash in
il3945_bg_reg_txpower_periodic():
https://bugzilla.kernel.org/show_bug.cgi?id=42766#c10

Patch fix problem by adding il->txq check on works that send commands,
hence utilize tx queue.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Stanislaw Gruszka authored and Greg Kroah-Hartman committed Mar 23, 2012
1 parent 97490c4 commit 8290924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions drivers/net/wireless/iwlegacy/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -1872,11 +1872,12 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
struct iwl_priv *priv = container_of(work, struct iwl_priv,
_3945.thermal_periodic.work);

if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

mutex_lock(&priv->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status) || priv->txq == NULL)
goto out;

iwl3945_reg_txpower_periodic(priv);
out:
mutex_unlock(&priv->mutex);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlegacy/iwl3945-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data)
container_of(data, struct iwl_priv, alive_start.work);

mutex_lock(&priv->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
if (test_bit(STATUS_EXIT_PENDING, &priv->status) || priv->txq == NULL)
goto out;

iwl3945_alive_start(priv);
Expand Down

0 comments on commit 8290924

Please sign in to comment.