From: Bart Van Assche <bvanassche@acm.org>
To: Liao Chen <liaochen4@huawei.com>,
GR-QLogic-Storage-Upstream@marvell.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: skashyap@marvell.com, jhasan@marvell.com,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, njavali@marvell.com
Subject: Re: [PATCH] scsi: qedf: Fix potential null pointer dereference
Date: Thu, 19 Sep 2024 09:11:47 -0700 [thread overview]
Message-ID: <8e8d2268-fde5-4f0e-949c-b2a929f41474@acm.org> (raw)
In-Reply-To: <20240913033627.1465713-1-liaochen4@huawei.com>
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.
prev parent reply other threads:[~2024-09-19 16:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 3:36 Liao Chen
2024-09-19 6:43 ` liaochen (A)
2024-09-19 16:11 ` Bart Van Assche [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e8d2268-fde5-4f0e-949c-b2a929f41474@acm.org \
--to=bvanassche@acm.org \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jhasan@marvell.com \
--cc=liaochen4@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=skashyap@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®