Skip to content

Commit aa7069d

Browse files
JiangJiasmartinkpetersen
authored andcommitted
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: 61d8658 ("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>
1 parent c77b1f8 commit aa7069d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/scsi/qedf/qedf_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,8 @@ static void qedf_upload_connection(struct qedf_ctx *qedf,
14151415
*/
14161416
term_params = dma_alloc_coherent(&qedf->pdev->dev, QEDF_TERM_BUFF_SIZE,
14171417
&term_params_dma, GFP_KERNEL);
1418+
if (!term_params)
1419+
return;
14181420

14191421
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Uploading connection "
14201422
"port_id=%06x.\n", fcport->rdata->ids.port_id);

0 commit comments

Comments
 (0)