mwifiex: add a bounds check in mwifiex_process_sta_rx_packet()
Subsystems (2)
PATCH 1/1 mwifiex: add a bounds check in mwifiex_process_sta_rx_packet()
Smatch complains that "local_rx_pd->priority" can't be trusted because it comes from skb->data and it can go up to 255 instead of being capped in the 0-7 range. A few lines earlier, on the other side of the if statement, we cap priority so it seems harmless to add a bounds check here as well.
--- drivers/net/wireless/marvell/mwifiex/sta_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/sta_rx.c +2 -1
@@ -250,7 +250,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, local_rx_pd->nf); } }else { -if (rx_pkt_type !=PKT_TYPE_BAR ) +if (rx_pkt_type !=PKT_TYPE_BAR && + local_rx_pd->priority <MAX_NUM_TID ) priv->rx_seq[local_rx_pd->priority] = seq_num;memcpy (ta, priv->curr_bss_params.bss_descriptor.mac_address,ETH_ALEN );
Signature · 1 line
2.17.1
Quoted 8 lines · Dan Carpenter
Smatch complains that "
local_rx_pd->priority" can't be trusted because it comes fromskb->dataand it can go up to 255 instead of being capped in the 0-7 range. A few lines earlier, on the other side of the if statement, we cap priority so it seems harmless to add a bounds check here as well.Signed-off-by Dan Carpenter <[email protected]>
Seems right to me:
Quoted 8 lines · Dan Carpenter
Smatch complains that "
local_rx_pd->priority" can't be trusted because it comes fromskb->dataand it can go up to 255 instead of being capped in the 0-7 range. A few lines earlier, on the other side of the if statement, we cap priority so it seems harmless to add a bounds check here as well.Signed-off-by Dan Carpenter <[email protected]>Reviewed-by Brian Norris <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
2cd2b42439ea mwifiex: add a bounds check in mwifiex_process_sta_rx_packet()
Signature · 3 lines
https://patchwork.kernel.org/patch/10881135/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches