iwlwifi: mvm: debugfs: check length precisely in inject_packet
authorJohannes Berg <johannes.berg@intel.com>
Sun, 17 Jan 2021 14:52:33 +0000 (16:52 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 5 Feb 2021 09:55:20 +0000 (11:55 +0200)
commit5c255a10711b139877044164b5822ef4e8811c7c
treee03a17ddd145366439005c5429473d6f3dde6b20
parent9aae43a450e89db2f293d310b4342342388d2e96
iwlwifi: mvm: debugfs: check length precisely in inject_packet

When we check the length, we only check that the advertised
data length fits into the data we have, but currently not
that it actually matches correctly.

This should be harmless, but if the first two bytes are zero,
then the iwl_rx_packet_payload_len() ends up negative, and
that might later cause issues if unsigned variables are used,
as this is not something that's normally expected.

Change the validation here to precisely validate the lengths
match, to avoid such issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117164916.5184dfc2a445.I0631d2e4f6ffb93cf06618edb035c45bd6d1d7b9@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c