diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2021-12-16 18:14:49 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-01-05 00:19:28 -0500 |
commit | aa7069d840dab6bef4887657b94e439c82ae985a (patch) | |
tree | 6455b555ae956d88d3208c1d84987c208a218156 /drivers/scsi | |
parent | c77b1f8a8faeeba43c694d9d09d0b25a4f52cf37 (diff) | |
download | linux-stable-aa7069d840dab6bef4887657b94e439c82ae985a.tar.gz linux-stable-aa7069d840dab6bef4887657b94e439c82ae985a.tar.bz2 linux-stable-aa7069d840dab6bef4887657b94e439c82ae985a.zip |
scsi: qedf: Fix potential dereference of NULL pointer
The return value of dma_alloc_coherent() needs to be checked to avoid use
of NULL pointer in case of an allocation failure.
Link: https://lore.kernel.org/r/20211216101449.375953-1-jiasheng@iscas.ac.cn
Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Acked-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qedf/qedf_main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 1bf7a22d4948..cdc66e2a9488 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1415,6 +1415,8 @@ static void qedf_upload_connection(struct qedf_ctx *qedf, */ term_params = dma_alloc_coherent(&qedf->pdev->dev, QEDF_TERM_BUFF_SIZE, &term_params_dma, GFP_KERNEL); + if (!term_params) + return; QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Uploading connection " "port_id=%06x.\n", fcport->rdata->ids.port_id); |