Patch "mac80211: fix potential overflow when multiplying to u32 integers" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mac80211: fix potential overflow when multiplying to u32 integers

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mac80211-fix-potential-overflow-when-multiplying-to-.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit da4c0942b1cb55fd4a2baa494b3ff9a934b8bc02
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Fri Feb 5 17:53:52 2021 +0000

    mac80211: fix potential overflow when multiplying to u32 integers
    
    [ Upstream commit 6194f7e6473be78acdc5d03edd116944bdbb2c4e ]
    
    The multiplication of the u32 variables tx_time and estimated_retx is
    performed using a 32 bit multiplication and the result is stored in
    a u64 result. This has a potential u32 overflow issue, so avoid this
    by casting tx_time to a u64 to force a 64 bit multiply.
    
    Addresses-Coverity: ("Unintentional integer overflow")
    Fixes: 050ac52cbe1f ("mac80211: code for on-demand Hybrid Wireless Mesh Protocol")
    Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210205175352.208841-1-colin.king@xxxxxxxxxxxxx
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index aa5150929996d..b5b728a71ab53 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -356,7 +356,7 @@ u32 airtime_link_metric_get(struct ieee80211_local *local,
 	 */
 	tx_time = (device_constant + 10 * test_frame_len / rate);
 	estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
-	result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
+	result = ((u64)tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
 	return (u32)result;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux