libertas: make lbs_ibss_join_existing() return error code on rates overflow
authorNicolai Stange <nstange@suse.de>
Tue, 14 Jan 2020 10:39:03 +0000 (11:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:33:27 +0000 (16:33 -0500)
commit1de085c83fad8d66fa1fb57880730a92367d8984
tree866c4f17e73d079e5d9db42f8070b128cee3349c
parent8ffeb2114dc105c7b47a18a85dd8acd611242b5d
libertas: make lbs_ibss_join_existing() return error code on rates overflow

[ Upstream commit 1754c4f60aaf1e17d886afefee97e94d7f27b4cb ]

Commit e5e884b42639 ("libertas: Fix two buffer overflows at parsing bss
descriptor") introduced a bounds check on the number of supplied rates to
lbs_ibss_join_existing() and made it to return on overflow.

However, the aforementioned commit doesn't set the return value accordingly
and thus, lbs_ibss_join_existing() would return with zero even though it
failed.

Make lbs_ibss_join_existing return -EINVAL in case the bounds check on the
number of supplied rates fails.

Fixes: e5e884b42639 ("libertas: Fix two buffer overflows at parsing bss descriptor")
Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/marvell/libertas/cfg.c