Hi,
Changing modes using "iwpriv ath0 mode x" while the device is in active scan mode will cause the driver to get into an infinite loop, causing the system to become unresponsive.
Attached is a debug log of console output, using 80211debug +state +scan and athdebug +state +mode. You will see that the interface is brought up, and starts an active scan (in this case, the interface was in AP mode, but it also happens in other modes).
Some way through the scan I issue the command "iwpriv ath0 mode 1". At this point we see the driver do a SCAN -> SCAN transition, and check_scan says that an active scan is already in progress. However, there is now nothing in the scan list, and we see an inifinite loop of scan_next, scan_start, scan_end, ap_end messages, with no mode_init messages like there should be.
I've been hunting around the code for a while, but can't quite figure out where to fix it, as this is my first attempt at debugging driver code. I added a call to ieee80211_cancel_scan on a SCAN->SCAN transition in ieee80211_scan.c and this stops the infinite loop from occuring, but I'm not sure how to get it going again on the proper mode, with the proper scan list.
Thanks for your time,
Scott Raynel.