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: <fb00ce7a-6f11-4769-b9eb-4011f076aa83@acm.org>
Date: Fri, 20 Sep 2024 09:43:27 -0700
From: Bart Van Assche <bvanassche@....org>
To: Liao Chen <liaochen4@...wei.com>, GR-QLogic-Storage-Upstream@...vell.com,
 linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: skashyap@...vell.com, jhasan@...vell.com,
 James.Bottomley@...senPartnership.com, martin.petersen@...cle.com
Subject: Re: [PATCH -next] scsi: qedf: Fix potential null pointer dereference

On 9/19/24 7:08 PM, Liao Chen wrote:
> qedf is checked to be null in this if branch, accessing its member will
> cause a null pointer dereference. As suggested by Bart, fix it by
> deleting the logic since qedf cannot be NULL in this function.
> 
> Signed-off-by: Liao Chen <liaochen4@...wei.com>
> ---
>   drivers/scsi/qedf/qedf_main.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index cf13148ba281..df756f3eef3e 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -4018,11 +4018,6 @@ void qedf_stag_change_work(struct work_struct *work)
>   	struct qedf_ctx *qedf =
>   	    container_of(work, struct qedf_ctx, stag_work.work);
>   
> -	if (!qedf) {
> -		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
> -		return;
> -	}
> -
>   	if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
>   		QEDF_ERR(&qedf->dbg_ctx,
>   			 "Already is in recovery, hence not calling software context reset.\n");

The patch looks good to me but the patch description could be more
clear and the subject is wrong. How about this?

[PATCH] scsi: qedf: Remove dead code

If container_of() is used correctly, its result is never NULL. Remove
the code that depends on container_of() returning a NULL pointer.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ