diff options
author | Tuo Li <[email protected]> | 2021-08-06 06:30:29 -0700 |
---|---|---|
committer | Jason Gunthorpe <[email protected]> | 2021-08-19 11:33:35 -0300 |
commit | cbe71c61992c38f72c2b625b2ef25916b9f0d060 (patch) | |
tree | 82c67e96e84228f0e7e3be6f0bb55333414958c4 /lib/test_overflow.c | |
parent | 0032640204a7d73bef163638c34a4642f8c9ed07 (diff) |
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/[email protected]
Reported-by: TOTE Robot <[email protected]>
Signed-off-by: Tuo Li <[email protected]>
Tested-by: Mike Marciniszyn <[email protected]>
Acked-by: Mike Marciniszyn <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions