On Sun, Jun 06, 2021 at 11:46:38AM -0700, Wenli Looi wrote: > Uninitialized struct with invalid pointer causes BUG and prevents access > point from working. Access point works once I apply this patch. > > This problem seems to have been present from the time the driver was > added to staging. Most users probably do not use access point so they > will not encounter this bug. > > https://forum.armbian.com/topic/14727-wifi-ap-kernel-bug-in-kernel-5444/ > has more details. > > kzalloc() seems to be what other drivers are doing in the same situation > of creating struct station_info and calling cfg80211_new_sta. In > particular, other drivers like ath6kl and mwifiex will silently return > when kzalloc fails, so this seems like the right behavior. (mwifiex > returns -ENOMEM from the place kzalloc is called, but if you follow the > chain of calls, the return value is ultimately ignored) > > Links to same situation in other drivers: > https://github.com/torvalds/linux/blob/f5b6eb1e018203913dfefcf6fa988649ad11ad6e/drivers/net/wireless/ath/ath6kl/main.c#L488 > https://github.com/torvalds/linux/blob/f5b6eb1e018203913dfefcf6fa988649ad11ad6e/drivers/net/wireless/marvell/mwifiex/uap_event.c#L120 > > Signed-off-by: Wenli Looi <wlooi@xxxxxxxxxxx> > --- > > v1 -> v2: Switched from large stack variable to kzalloc Nah, v1 was better, it just needs an updated commit message. See my other email for more details. regards, dan carpenter