rtlwifi: Fix potential overflow on P2P code
authorLaura Abbott <labbott@redhat.com>
Fri, 18 Oct 2019 11:43:21 +0000 (07:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Nov 2019 11:18:22 +0000 (12:18 +0100)
commit4a2fbab9e82fb662ad3419525742a1ddfc29a7b9
tree6660a7ff9b0e5fff38cf1517b6d6f607dae772e4
parent8dc59b45792c801efa55e5463818bd08e5e16ded
rtlwifi: Fix potential overflow on P2P code

commit 8c55dedb795be8ec0cf488f98c03a1c2176f7fb1 upstream.

Nicolas Waisman noticed that even though noa_len is checked for
a compatible length it's still possible to overrun the buffers
of p2pinfo since there's no check on the upper bound of noa_num.
Bound noa_num against P2P_MAX_NOA_NUM.

Reported-by: Nicolas Waisman <nico@semmle.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/realtek/rtlwifi/ps.c