From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: John Meneghini <jmeneghi@redhat.com>, martin.petersen@oracle.com
Cc: axboe@kernel.dk, bgurney@redhat.com, emilne@redhat.com,
gustavoars@kernel.org, hare@suse.de, hch@lst.de,
james.smart@broadcom.com, kbusch@kernel.org, kees@kernel.org,
linux-hardening@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-scsi@vger.kernel.org, njavali@marvell.com,
sagi@grimberg.me
Subject: Re: [PATCH] Revert "scsi: qla2xxx: Fix memcpy() field-spanning write issue"
Date: Thu, 25 Sep 2025 16:30:20 +0200 [thread overview]
Message-ID: <97526d45-ec7d-48a0-bdc6-659f75839f53@embeddedor.com> (raw)
In-Reply-To: <fbbef12e-fc43-464f-b92d-f42f3692a46c@redhat.com>
On 9/25/25 16:18, John Meneghini wrote:
> On 9/25/25 9:38 AM, Gustavo A. R. Silva wrote:
>> On 9/25/25 15:07, John Meneghini wrote:
>>> This reverts commit 6f4b10226b6b1e7d1ff3cdb006cf0f6da6eed71e.
>>>
>>> We've been testing this patch and it turns out there is a significant
>>> bug here. This leaks memory and causes a driver hang.
>>>
>>> Link:
>>> https://lore.kernel.org/linux-scsi/yq1zfajqpec.fsf@ca-mkp.ca.oracle.com/
>>
>> Thanks for the report. I wonder if you have any logs or something I could
>> look at to figure out what's going on.
>
>
> We have a fix already. Chris and Bryan figured it out.
>
>> Bryan,
>>
>> Could you please share how this patch[1] was tested?
>
> Bryan, please reply with bug fix patch you emailed me yesterday as an RFC patch.
>
> Gustavo, this patch is being tested as a part of our FPIN LI changes. To run this code you need a Brocade switch and a whole lot of hardware.
>
> You can see a example test plan here: https://bugzilla.kernel.org/attachment.cgi?id=308368&action=view
>
> I am about to submit a version 10 patch series for these changes and I will include a new/fixed version of your patch in that series.
Awesome, thank you!
I was in the process of writing the following (draft) patch, which is much
less intrusive than the other one:
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index cb95b7b12051..1b000709ccd8 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -4890,9 +4890,10 @@ struct purex_item {
struct purex_item *pkt);
atomic_t in_use;
uint16_t size;
- struct {
- uint8_t iocb[64];
- } iocb;
+ union {
+ uint8_t min_iocb[QLA_DEFAULT_PAYLOAD_SIZE];
+ DECLARE_FLEX_ARRAY(uint8_t, iocb);
+ };
};
#include "qla_edif.h"
@@ -5101,7 +5102,6 @@ typedef struct scsi_qla_host {
struct list_head head;
spinlock_t lock;
} purex_list;
- struct purex_item default_item;
struct name_list_extended gnl;
/* Count of active session/fcport */
@@ -5130,6 +5130,9 @@ typedef struct scsi_qla_host {
#define DPORT_DIAG_IN_PROGRESS BIT_0
#define DPORT_DIAG_CHIP_RESET_IN_PROGRESS BIT_1
uint16_t dport_status;
+
+ /* Must be last --ends in a flexible-array member. */
+ struct purex_item default_item;
} scsi_qla_host_t;
struct qla27xx_image_status {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index c4c6b5c6658c..a342e137a53a 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1137,7 +1137,7 @@ static struct purex_item
if (!item)
return item;
- memcpy(&item->iocb, pkt, sizeof(item->iocb));
+ memcpy(&item->iocb, pkt, QLA_DEFAULT_PAYLOAD_SIZE);
return item;
}
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 316594aa40cc..065f9bcca26f 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -1308,7 +1308,7 @@ void qla2xxx_process_purls_iocb(void **pkt, struct rsp_que **rsp)
ql_dbg(ql_dbg_unsol, vha, 0x2121,
"PURLS OP[%01x] size %d xchg addr 0x%x portid %06x\n",
- item->iocb.iocb[3], item->size, uctx->exchange_address,
+ item->iocb[3], item->size, uctx->exchange_address,
fcport->d_id.b24);
/* +48 0 1 2 3 4 5 6 7 8 9 A B C D E F
* ----- -----------------------------------------------
But if you already figured it out, that's great. :)
Thanks
-Gustavo
> /John
>
>> Thanks
>> -Gustavo
>>
>> [1] https://lore.kernel.org/linux-scsi/20250813200744.17975-10-bgurney@redhat.com/
>>
>
next prev parent reply other threads:[~2025-09-25 14:30 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 20:07 [PATCH v9 0/8] nvme-fc: FPIN link integrity handling Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 1/9] fc_els: use 'union fc_tlv_desc' Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 2/9] nvme: add NVME_CTRL_MARGINAL flag Bryan Gurney
2025-08-18 12:07 ` Hannes Reinecke
2025-08-13 20:07 ` [PATCH v9 3/9] nvme-fc: marginal path handling Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 4/9] nvme-fc: nvme_fc_fpin_rcv() callback Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 5/9] lpfc: enable FPIN notification for NVMe Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 6/9] qla2xxx: " Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 7/9] nvme: sysfs: emit the marginal path state in show_state() Bryan Gurney
2025-08-13 20:07 ` [PATCH v9 8/9] nvme-multipath: queue-depth support for marginal paths Bryan Gurney
2025-08-18 12:08 ` Hannes Reinecke
2025-08-13 20:07 ` [PATCH v9 9/9] scsi: qla2xxx: Fix memcpy field-spanning write issue Bryan Gurney
2025-08-18 12:09 ` Hannes Reinecke
2025-08-20 2:13 ` Martin K. Petersen
2025-08-20 2:18 ` [PATCH v9 0/8] nvme-fc: FPIN link integrity handling Martin K. Petersen
2025-08-26 2:33 ` (subset) " Martin K. Petersen
2025-09-23 19:21 ` John Meneghini
2025-09-25 1:43 ` Martin K. Petersen
2025-09-25 13:07 ` [PATCH] Revert "scsi: qla2xxx: Fix memcpy() field-spanning write issue" John Meneghini
2025-09-25 13:38 ` Gustavo A. R. Silva
2025-09-25 14:18 ` John Meneghini
2025-09-25 14:30 ` Gustavo A. R. Silva [this message]
2025-09-25 17:02 ` [PATCH RFC] scsi: qla2xxx: zero default_item last in qla24xx_free_purex_item Bryan Gurney
[not found] ` <e58d743b-a999-4e00-8f2e-31707744c5bb@embeddedor.com>
2025-09-25 18:43 ` Bryan Gurney
2025-09-25 18:54 ` Gustavo A. R. Silva
2025-09-25 18:57 ` [PATCH] Revert "scsi: qla2xxx: Fix memcpy() field-spanning write issue" Gustavo A. R. Silva
2025-09-30 9:35 ` John Meneghini
2025-09-30 20:13 ` Martin K. Petersen
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=97526d45-ec7d-48a0-bdc6-659f75839f53@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=axboe@kernel.dk \
--cc=bgurney@redhat.com \
--cc=emilne@redhat.com \
--cc=gustavoars@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=jmeneghi@redhat.com \
--cc=kbusch@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=sagi@grimberg.me \
/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