Kernel crash when wlan0 in AP mode (in some situations)

Hello All,

May be this information will be helpful. I have faced with kernel oops when using hostapd on Jetson TX2. Howto reproduce:

Start ‘hostapd’ and then kill it with -9 signal (or simulate sigsegv, etc).
In this case hostapd doesn’t switch wlan0 to ‘station’ mode.
Next two starts of ‘hostapd’ will cause above oops.

I have prepared simple patch to avoid this crash:

Please apply it upstream if this patch looks ok.

P.S.
I’m running hostapd inside docker container. In some situations ‘docker stop’ will use ‘kill -9’ (if no response in 10 sec) and cause above crash when following ‘docker run’ called.

Hi aospan,

Thanks for sharing this.

Start 'hostapd' and then kill it with -9 signal (or simulate sigsegv, etc).
In this case hostapd doesn't switch wlan0 to 'station' mode.

How about using NM(NetworkManager)? Can you reproduce this issue?

What do you mean “In this case hostapd doesn’t switch wlan0 to ‘station’ mode.”??
You firstly set hostapd and then kill it. After that, wlan0 can not be station mode anymore but only AP mode?

I have checked NM now. Looks like it doesn’t start ‘true’ AccessPoint (BSS) but starts Adhoc (IBSS). NM calls it ‘Hotspot’.
So, it doesn’t interfere with my patch which covers only ‘true’ AP use-cases.

If you stop hostapd normally (with Ctrl-C for example) it executes their exit routines normally and switch interface back to ‘station’ mode. Here is the snippet from hostapd sources:

static int wpa_driver_nl80211_deinit_ap(void *priv)
{
...
        return wpa_driver_nl80211_set_mode(priv, NL80211_IFTYPE_STATION);
}

so, if we stop hostapd normally it will switch wlan0 to ‘station’ mode. If we kill it with -9 (or sigsegv happens) it doesn’t. In this case next start of hostapd will try to switch wlan0 to AP mode and cause above mentioned crash.

I didn’t seen hostapd sigsegv but not 100% sure it’s not possible. I have observed hostapd ‘kill -9’ when using it inside docker container.

I have received update from Broadcom’s engineers:

this issue was fixed already in upstream driver:

https://android.googlesource.com/kernel/msm/+/40ff81b503a3bcfca8146aa32527cea675dbfab9^!/#F0

I think Jetson kernel source should catch upstream …

Thank you aospan, we have opened an internal issue to track this patch you referenced and look into integrating it into the Jetson’s L4T kernel.