iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()
authorLuca Coelho <luciano.coelho@intel.com>
Sat, 13 Oct 2018 06:46:08 +0000 (09:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:04 +0000 (11:15 -0800)
commit0c38cad1d15004c2d6dc188a6f3f362a98883334
treec82c2abb0a31646ea4418ca3613f898832ac2a09
parentc459fed018c33ae79dbb892ba2a5874cc7932781
iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()

commit 3d71c3f1f50cf309bd20659422af549bc784bfff upstream.

The rs_rate_from_ucode_rate() function may return -EINVAL if the rate
is invalid, but none of the callsites check for the error, potentially
making us access arrays with index IWL_RATE_INVALID, which is larger
than the arrays, causing an out-of-bounds access.  This will trigger
KASAN warnings, such as the one reported in the bugzilla issue
mentioned below.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=200659

Cc: stable@vger.kernel.org
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/intel/iwlwifi/mvm/rs.c