scsi: qedf: Fix potential null pointer dereference
Subsystems (2)
PATCH 1/1 scsi: qedf: Fix potential null pointer dereference
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.
--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -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 ; }
Signature · 1 line
2.34.1
Quoted 15 lines · Liao Chen
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 <[email protected]>--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/qedf/qedf_main.c +0
-0
drivers/scsi/qedf/qedf_main.c void qedf_stag_change_work(struct work_struct *work) · line 4027
Quoted 8 lines
drivers/scsi/qedf/qedf_main.c +1
-1@@ -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
Quoted 15 lines · Liao Chen
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 <[email protected]>--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/qedf/qedf_main.c +0
-0
drivers/scsi/qedf/qedf_main.c void qedf_stag_change_work(struct work_struct *work) · line 4026
Quoted 7 lines
drivers/scsi/qedf/qedf_main.c +1
-1@@ -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.