Commit e1c24ce
wifi: rtl8xxxu: fix potential use of uninitialized value
[ Upstream commit f8a2fc8 ]
The local variables 'mcs' and 'nss' in rtl8xxxu_update_ra_report() are
passed to rtl8xxxu_desc_to_mcsrate() as output parameters. If the helper
function encounters an unhandled rate index, it may return without setting
these values, leading to the use of uninitialized stack data.
Remove the helper rtl8xxxu_desc_to_mcsrate() and inline the logic into
rtl8xxxu_update_ra_report(). This fixes the use of uninitialized 'mcs'
and 'nss' variables for legacy rates.
The new implementation explicitly handles:
- Legacy rates: Set bitrate only.
- HT rates (MCS0-15): Set MCS flags, index, and NSS (1 or 2) directly.
- Invalid rates: Return early.
Fixes: 7de1612 ("wifi: rtl8xxxu: Introduce rtl8xxxu_update_ra_report")
Cc: stable@vger.kernel.org
Suggested-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yi Cong <yicong@kylinos.cn>
Link: https://lore.kernel.org/all/96e31963da0c42dcb52ce44f818963d7@realtek.com/
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260306071627.56501-1-cong.yi@linux.dev
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 3ca80e3 commit e1c24ce
1 file changed
Lines changed: 8 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4809 | 4809 | | |
4810 | 4810 | | |
4811 | 4811 | | |
4812 | | - | |
4813 | | - | |
4814 | | - | |
4815 | | - | |
4816 | | - | |
4817 | | - | |
4818 | | - | |
4819 | | - | |
4820 | | - | |
4821 | | - | |
4822 | | - | |
4823 | | - | |
4824 | | - | |
4825 | | - | |
4826 | 4812 | | |
4827 | 4813 | | |
4828 | 4814 | | |
| |||
4927 | 4913 | | |
4928 | 4914 | | |
4929 | 4915 | | |
4930 | | - | |
4931 | | - | |
4932 | 4916 | | |
4933 | 4917 | | |
4934 | 4918 | | |
4935 | 4919 | | |
4936 | | - | |
4937 | | - | |
| 4920 | + | |
4938 | 4921 | | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
4939 | 4926 | | |
4940 | | - | |
4941 | | - | |
| 4927 | + | |
4942 | 4928 | | |
4943 | 4929 | | |
4944 | 4930 | | |
4945 | 4931 | | |
4946 | 4932 | | |
| 4933 | + | |
| 4934 | + | |
4947 | 4935 | | |
4948 | 4936 | | |
4949 | 4937 | | |
| |||
0 commit comments