linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: fix NULL-deref in hw_per_calibration() for ar9002
@ 2014-05-07  7:22 David Herrmann
  2014-05-07 19:54 ` John W. Linville
  2014-05-08 18:18 ` Rajkumar Manoharan
  0 siblings, 2 replies; 14+ messages in thread
From: David Herrmann @ 2014-05-07  7:22 UTC (permalink / raw)
  To: linux-wireless
  Cc: Luis R. Rodriguez, Jouni Malinen, Vasanthakumar Thiagarajan,
	Senthil Balasubramanian, John W. Linville, ath9k-devel,
	Oleksij Rempel, David Herrmann

ah->caldata may be NULL if no channel is selected. Check for that before
accessing it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
Hi

This is _definitely_ only a workaround, given that no-one guarantees ah->caldata
is freed while we run in hw_per_calibration(). However, this patch fixes serious
kernel panics with wifi-P2P on my machine.

I'm not sure why ah->caldata can be NULL, but it definitely is. I think the
correct fix would be to synchronously stop any running hw-calibration before
setting ah->caldata to NULL. I don't know whether/where that is done, so I wrote
this small workaround.

Thanks
David

 drivers/net/wireless/ath/ath9k/ar9002_calib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index cdc7400..4667ab9 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -99,14 +99,16 @@ static bool ar9002_hw_per_calibration(struct ath_hw *ah,
 				}
 
 				currCal->calData->calPostProc(ah, numChains);
-				caldata->CalValid |= currCal->calData->calType;
+				if (caldata)
+					caldata->CalValid |= currCal->calData->calType;
+
 				currCal->calState = CAL_DONE;
 				iscaldone = true;
 			} else {
 				ar9002_hw_setup_calibration(ah, currCal);
 			}
 		}
-	} else if (!(caldata->CalValid & currCal->calData->calType)) {
+	} else if (caldata && !(caldata->CalValid & currCal->calData->calType)) {
 		ath9k_hw_reset_calibration(ah, currCal);
 	}
 
-- 
1.9.2


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

end of thread, other threads:[~2014-05-13 18:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07  7:22 [PATCH] ath9k: fix NULL-deref in hw_per_calibration() for ar9002 David Herrmann
2014-05-07 19:54 ` John W. Linville
2014-05-07 20:03   ` [ath9k-devel] " Luis R. Rodriguez
2014-05-07 20:38     ` John W. Linville
2014-05-07 20:15   ` Felix Fietkau
2014-05-12 17:49     ` John W. Linville
2014-05-12 18:43       ` Felix Fietkau
2014-05-13  6:50         ` David Herrmann
2014-05-13  9:00           ` Rajkumar Manoharan
2014-05-13  9:09             ` David Herrmann
2014-05-13 10:41               ` Rajkumar Manoharan
2014-05-13 18:21                 ` David Herrmann
2014-05-08 18:18 ` Rajkumar Manoharan
2014-05-08 20:16   ` David Herrmann

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