mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
wifi: mt76: mt7925: fix potential tx_retries underflow
When FIELD_GET returns 0 for the retry count, subtracting 1 causes
an unsigned integer underflow, resulting in tx_retries becoming a
very large value (0xFFFFFFFF for u32).
Fix by checking if count is non-zero before subtracting 1.
Fixes: c948b5da6b ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/20260605113306.3485554-3-ryder.lee@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
3c5671ed81
commit
1e1fd84571
|
|
@ -1149,8 +1149,9 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len)
|
|||
|
||||
if (info & MT_TXFREE_INFO_HEADER) {
|
||||
if (wcid) {
|
||||
wcid->stats.tx_retries +=
|
||||
FIELD_GET(MT_TXFREE_INFO_COUNT, info) - 1;
|
||||
u32 count = FIELD_GET(MT_TXFREE_INFO_COUNT, info);
|
||||
|
||||
wcid->stats.tx_retries += count ? count - 1 : 0;
|
||||
wcid->stats.tx_failed +=
|
||||
!!FIELD_GET(MT_TXFREE_INFO_STAT, info);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user