]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iwlwifi: pcie: fix indexing in command dump for new HW
authorJohannes Berg <johannes.berg@intel.com>
Wed, 4 Sep 2019 14:23:27 +0000 (16:23 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Oct 2019 10:01:04 +0000 (13:01 +0300)
commit08326a97afbe808e50e1610c2835fa2747bdb908
treeec738c7292f62a9d70eb3a6e993a44143a44ff0a
parenta2113cc44d4387a7c3ef3a9082d273524f9230ac
iwlwifi: pcie: fix indexing in command dump for new HW

We got a crash in iwl_trans_pcie_get_cmdlen(), while the TFD was
being accessed to sum up the lengths.

We want to access the TFD here, which is the information for the
hardware. We always only allocate 32 buffers for the cmd queue,
but on newer hardware (using TFH) we can also allocate only a
shorter hardware array, also only 32 TFDs. Prior to the TFH, we
had to allocate a bigger TFD array but would make those point to
a smaller set of buffers.

Additionally, now max_tfd_queue_size is up to 65536, so we can
access *way* out of bounds of a really only 32-entry array, so
it crashes.

Fix this by making the TFD index depend on which hardware we are
using right now.

While changing the calculation, also fix it to not use void ptr
arithmetic, but cast to u8 * before.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/trans.c