mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: qedf: Fix potential null pointer dereference
@ 2024-09-13  3:36 Liao Chen
  2024-09-19  6:43 ` liaochen (A)
  2024-09-19 16:11 ` Bart Van Assche
  0 siblings, 2 replies; 3+ messages in thread
From: Liao Chen @ 2024-09-13  3:36 UTC (permalink / raw)
  To: GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel
  Cc: skashyap, jhasan, James.Bottomley, martin.petersen, njavali

qedf is checked to be null in this if branch, accessing its member will
cause a null pointer dereference. Fix it by passing a direct NULL into
the error function.

Fixes: 51071f0831ea ("scsi: qedf: Don't process stag work during unload and recovery")
Signed-off-by: Liao Chen <liaochen4@huawei.com>
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 4813087e58a1..9d4738db0e51 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -4021,7 +4021,7 @@ void qedf_stag_change_work(struct work_struct *work)
 	    container_of(work, struct qedf_ctx, stag_work.work);
 
 	if (!qedf) {
-		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
+		QEDF_ERR(NULL, "qedf is NULL");
 		return;
 	}
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedf: Fix potential null pointer dereference
  2024-09-13  3:36 [PATCH] scsi: qedf: Fix potential null pointer dereference Liao Chen
@ 2024-09-19  6:43 ` liaochen (A)
  2024-09-19 16:11 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: liaochen (A) @ 2024-09-19  6:43 UTC (permalink / raw)
  To: GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel
  Cc: skashyap, jhasan, James.Bottomley, martin.petersen, njavali

On 2024/9/13 11:36, Liao Chen wrote:
> qedf is checked to be null in this if branch, accessing its member will
> cause a null pointer dereference. Fix it by passing a direct NULL into
> the error function.
> 
> Fixes: 51071f0831ea ("scsi: qedf: Don't process stag work during unload and recovery")
> Signed-off-by: Liao Chen <liaochen4@huawei.com>
> ---
>   drivers/scsi/qedf/qedf_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 4813087e58a1..9d4738db0e51 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -4021,7 +4021,7 @@ void qedf_stag_change_work(struct work_struct *work)
>   	    container_of(work, struct qedf_ctx, stag_work.work);
>   
>   	if (!qedf) {
> -		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
> +		QEDF_ERR(NULL, "qedf is NULL");
>   		return;
>   	}
>   
gentle ping

Thanks,
Chen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedf: Fix potential null pointer dereference
  2024-09-13  3:36 [PATCH] scsi: qedf: Fix potential null pointer dereference Liao Chen
  2024-09-19  6:43 ` liaochen (A)
@ 2024-09-19 16:11 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2024-09-19 16:11 UTC (permalink / raw)
  To: Liao Chen, GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel
  Cc: skashyap, jhasan, James.Bottomley, martin.petersen, njavali

On 9/12/24 8:36 PM, Liao Chen wrote:
> qedf is checked to be null in this if branch, accessing its member will
> cause a null pointer dereference. Fix it by passing a direct NULL into
> the error function.
> 
> Fixes: 51071f0831ea ("scsi: qedf: Don't process stag work during unload and recovery")
> Signed-off-by: Liao Chen <liaochen4@huawei.com>
> ---
>   drivers/scsi/qedf/qedf_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 4813087e58a1..9d4738db0e51 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -4021,7 +4021,7 @@ void qedf_stag_change_work(struct work_struct *work)
>   	    container_of(work, struct qedf_ctx, stag_work.work);
>   
>   	if (!qedf) {
> -		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
> +		QEDF_ERR(NULL, "qedf is NULL");
>   		return;
>   	}

I think it would be better to remove the if-statement and the
if-statement body since qedf cannot be NULL in this function.

Thanks,

Bart.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-19 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-13  3:36 [PATCH] scsi: qedf: Fix potential null pointer dereference Liao Chen
2024-09-19  6:43 ` liaochen (A)
2024-09-19 16:11 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®