Patch "wifi: mac80211: don't return unset power in ieee80211_get_tx_power()" has been added to the 5.15-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

    wifi: mac80211: don't return unset power in ieee80211_get_tx_power()

to the 5.15-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:
     wifi-mac80211-don-t-return-unset-power-in-ieee80211_.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 077f222cd0325ab63067616cb8764730fc15e124
Author: Ping-Ke Shih <pkshih@xxxxxxxxxxx>
Date:   Fri Feb 3 10:36:36 2023 +0800

    wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
    
    [ Upstream commit e160ab85166e77347d0cbe5149045cb25e83937f ]
    
    We can get a UBSAN warning if ieee80211_get_tx_power() returns the
    INT_MIN value mac80211 internally uses for "unset power level".
    
     UBSAN: signed-integer-overflow in net/wireless/nl80211.c:3816:5
     -2147483648 * 100 cannot be represented in type 'int'
     CPU: 0 PID: 20433 Comm: insmod Tainted: G        WC OE
     Call Trace:
      dump_stack+0x74/0x92
      ubsan_epilogue+0x9/0x50
      handle_overflow+0x8d/0xd0
      __ubsan_handle_mul_overflow+0xe/0x10
      nl80211_send_iface+0x688/0x6b0 [cfg80211]
      [...]
      cfg80211_register_wdev+0x78/0xb0 [cfg80211]
      cfg80211_netdev_notifier_call+0x200/0x620 [cfg80211]
      [...]
      ieee80211_if_add+0x60e/0x8f0 [mac80211]
      ieee80211_register_hw+0xda5/0x1170 [mac80211]
    
    In this case, simply return an error instead, to indicate
    that no data is available.
    
    Cc: Zong-Zhe Yang <kevin_yang@xxxxxxxxxxx>
    Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230203023636.4418-1-pkshih@xxxxxxxxxxx
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4fa216a108ae8..02bd90a537058 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2762,6 +2762,10 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy,
 	else
 		*dbm = sdata->vif.bss_conf.txpower;
 
+	/* INT_MIN indicates no power level was set yet */
+	if (*dbm == INT_MIN)
+		return -EINVAL;
+
 	return 0;
 }
 



[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