wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute
authorPhil Turnbull <philipturnbull@github.com>
Wed, 23 Nov 2022 15:35:42 +0000 (10:35 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:11 +0000 (17:41 +0100)
commite9de501cf70d2b508b2793ed3e7d5d5ceabd7a74
tree5d26d5a1b4d7791bdae2b1540d25cf02cff260db
parent143232cb5a4c96d69a7d90b643568665463c6191
wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute

commit f9b62f9843c7b0afdaecabbcebf1dbba18599408 upstream.

Validate that the IEEE80211_P2P_ATTR_CHANNEL_LIST attribute contains
enough space for a 'struct wilc_attr_oper_ch'. If the attribute is too
small then it can trigger an out-of-bounds write later in the function.

'struct wilc_attr_oper_ch' is variable sized so also check 'attr_len'
does not extend beyond the end of 'buf'.

Signed-off-by: Phil Turnbull <philipturnbull@github.com>
Tested-by: Ajay Kathat <ajay.kathat@microchip.com>
Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221123153543.8568-4-philipturnbull@github.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/microchip/wilc1000/cfg80211.c