Commit 7c15eb3
wifi: brcmfmac: pcie: handle randbuf allocation failure
[ Upstream commit 316f790 ]
The kzalloc() in brcmf_pcie_download_fw_nvram() will return null
if the physical memory has run out. As a result, if we use
get_random_bytes() to generate random bytes in the randbuf, the
null pointer dereference bug will happen.
In order to prevent allocation failure, this patch adds a separate
function using buffer on kernel stack to generate random bytes in
the randbuf, which could prevent the kernel stack from overflow.
Fixes: 91918ce ("wifi: brcmfmac: pcie: Provide a buffer of random bytes to the device")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240306140437.18177-1-duoming@zju.edu.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 3ef1480 commit 7c15eb3
1 file changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1675 | 1675 | | |
1676 | 1676 | | |
1677 | 1677 | | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
1678 | 1687 | | |
1679 | 1688 | | |
1680 | 1689 | | |
| |||
1717 | 1726 | | |
1718 | 1727 | | |
1719 | 1728 | | |
1720 | | - | |
1721 | 1729 | | |
1722 | 1730 | | |
1723 | 1731 | | |
| |||
1729 | 1737 | | |
1730 | 1738 | | |
1731 | 1739 | | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
| 1740 | + | |
1736 | 1741 | | |
1737 | 1742 | | |
1738 | 1743 | | |
| |||
0 commit comments