[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D9296ADB.1A233%skashyap@marvell.com>
Date: Fri, 14 Jun 2019 09:47:26 +0000
From: Saurav Kashyap <skashyap@...vell.com>
To: Young Xiao <92siuyang@...il.com>,
"QLogic-Storage-Upstream@...gic.com"
<QLogic-Storage-Upstream@...gic.com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] scsi: bnx2fc: Check if sense buffer has been allocated
during completion
-----Original Message-----
From: <linux-scsi-owner@...r.kernel.org> on behalf of Young Xiao
<92siuyang@...il.com>
Date: Friday, 14 June 2019 at 2:06 PM
To: "QLogic-Storage-Upstream@...gic.com"
<QLogic-Storage-Upstream@...gic.com>, "jejb@...ux.ibm.com"
<jejb@...ux.ibm.com>, "martin.petersen@...cle.com"
<martin.petersen@...cle.com>, "linux-scsi@...r.kernel.org"
<linux-scsi@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Cc: Young Xiao <92siuyang@...il.com>
Subject: [PATCH] scsi: bnx2fc: Check if sense buffer has been allocated
during completion
>sc_cmd->sense_buffer is not guaranteed to be allocated so we need to
>sc_cmd->check if the pointer is NULL before trying to copy anything into
>it.
>
>See commit 16a611154dc1 ("scsi: qedf: Check if sense buffer has been
>allocated
>during completion") for details.
>
>Signed-off-by: Young Xiao <92siuyang@...il.com>
>---
> drivers/scsi/bnx2fc/bnx2fc_io.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c
>b/drivers/scsi/bnx2fc/bnx2fc_io.c
>index 8def63c..44a5e59 100644
>--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
>+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
>@@ -1789,9 +1789,11 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd
>*io_req,
> fcp_sns_len = SCSI_SENSE_BUFFERSIZE;
> }
>
>- memset(sc_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
>- if (fcp_sns_len)
>- memcpy(sc_cmd->sense_buffer, rq_data, fcp_sns_len);
>+ if (sc_cmd->sense_buffer) {
>+ memset(sc_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
>+ if (fcp_sns_len)
>+ memcpy(sc_cmd->sense_buffer, rq_data, fcp_sns_len);
>+ }
>
> /* return RQ entries */
> for (i = 0; i < num_rq; i++)
>--
>2.7.4
Thanks for the patch
Acked-by: Saurav Kashyap <skashyap@...vell.com>
Thanks,
~Saurav
>
Powered by blists - more mailing lists