diff options
author | Tuo Li <islituo@gmail.com> | 2021-08-06 06:30:29 -0700 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-08-19 11:33:35 -0300 |
commit | cbe71c61992c38f72c2b625b2ef25916b9f0d060 (patch) | |
tree | 82c67e96e84228f0e7e3be6f0bb55333414958c4 /drivers/fpga/fpga-mgr.c | |
parent | 0032640204a7d73bef163638c34a4642f8c9ed07 (diff) | |
download | linux-stable-cbe71c61992c38f72c2b625b2ef25916b9f0d060.tar.gz linux-stable-cbe71c61992c38f72c2b625b2ef25916b9f0d060.tar.bz2 linux-stable-cbe71c61992c38f72c2b625b2ef25916b9f0d060.zip |
IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs()
kmalloc_array() is called to allocate memory for tx->descp. If it fails,
the function __sdma_txclean() is called:
__sdma_txclean(dd, tx);
However, in the function __sdma_txclean(), tx-descp is dereferenced if
tx->num_desc is not zero:
sdma_unmap_desc(dd, &tx->descp[0]);
To fix this possible null-pointer dereference, assign the return value of
kmalloc_array() to a local variable descp, and then assign it to tx->descp
if it is not NULL. Otherwise, go to enomem.
Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Link: https://lore.kernel.org/r/20210806133029.194964-1-islituo@gmail.com
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
Tested-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/fpga/fpga-mgr.c')
0 files changed, 0 insertions, 0 deletions