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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d84cd90f-9252-2329-9f36-c5c461a80290@broadcom.com>
Date:   Sat, 4 Mar 2017 09:42:38 -0800
From:   James Smart <james.smart@...adcom.com>
To:     Colin King <colin.king@...onical.com>,
        Dick Kennedy <dick.kennedy@...adcom.com>,
        "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: lpfc: sanity check hrq is null before dereferencing
 it

Looks good. I included it in the lpfc patch set just posted.

-- james


On 2/24/2017 5:56 AM, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> The sanity check for hrq should be moved to before the deference
> of hrq to ensure we don't perform a null pointer deference.
>
> Detected by CoverityScan, CID#1411650 ("Dereference before null check")
>
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>   drivers/scsi/lpfc/lpfc_sli.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index e43e5e2..1fba5dc 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -15185,17 +15185,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
>   		drq = drqp[idx];
>   		cq  = cqp[idx];
>   
> -		if (hrq->entry_count != drq->entry_count) {
> -			status = -EINVAL;
> -			goto out;
> -		}
> -
>   		/* sanity check on queue memory */
>   		if (!hrq || !drq || !cq) {
>   			status = -ENODEV;
>   			goto out;
>   		}
>   
> +		if (hrq->entry_count != drq->entry_count) {
> +			status = -EINVAL;
> +			goto out;
> +		}
> +
>   		if (idx == 0) {
>   			bf_set(lpfc_mbx_rq_create_num_pages,
>   			       &rq_create->u.request,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ