lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR18MB30344528373170A95E67B50CD2499@DM6PR18MB3034.namprd18.prod.outlook.com>
Date:   Mon, 3 Jan 2022 04:58:41 +0000
From:   Saurav Kashyap <skashyap@...vell.com>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>,
        Javed Hasan <jhasan@...vell.com>,
        GR-QLogic-Storage-Upstream <GR-QLogic-Storage-Upstream@...vell.com>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>
CC:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [EXT] [PATCH] scsi: qedf: potential dereference of null pointer

Hi Jiasheng Jiang,

> -----Original Message-----
> From: Jiasheng Jiang <jiasheng@...as.ac.cn>
> Sent: Thursday, December 16, 2021 3:45 PM
> To: Saurav Kashyap <skashyap@...vell.com>; Javed Hasan
> <jhasan@...vell.com>; GR-QLogic-Storage-Upstream <GR-QLogic-Storage-
> Upstream@...vell.com>; jejb@...ux.ibm.com; martin.petersen@...cle.com;
> linux@...linux.org.uk
> Cc: linux-scsi@...r.kernel.org; linux-kernel@...r.kernel.org;
> netdev@...r.kernel.org; Jiasheng Jiang <jiasheng@...as.ac.cn>
> Subject: [EXT] [PATCH] scsi: qedf: potential dereference of null pointer
> 
> External Email
> 
> ----------------------------------------------------------------------
> The return value of dma_alloc_coherent() needs to be checked.
> To avoid use of null pointer in case of the failure of alloc.
> 
> Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver
> framework.")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
>  drivers/scsi/qedf/qedf_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index b92570a7c309..309e205a8e70 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;

<SK> Adding message about failure before returning will help in debugging.

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

Powered by blists - more mailing lists