Skip to content

Commit f65f31a

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Fix incorrect request len mbox field when setting trunking via sysfs
When setting trunk modes through sysfs, the SLI_CONFIG mailbox command's command payload length is incorrectly hardcoded to 12 bytes. SLI_CONFIG's payload length field should be specified large enough to encompass both the submailbox command header and the submailbox request itself. Thus, replace the hardcoded 12 bytes with a clearer calculation by way of sizeof(struct lpfc_mbx_set_trunk_mode) - sizeof(struct lpfc_sli4_cfg_mhdr). Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ede596b commit f65f31a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,7 @@ static int
18311831
lpfc_set_trunking(struct lpfc_hba *phba, char *buff_out)
18321832
{
18331833
LPFC_MBOXQ_t *mbox = NULL;
1834+
u32 payload_len;
18341835
unsigned long val = 0;
18351836
char *pval = NULL;
18361837
int rc = 0;
@@ -1869,9 +1870,11 @@ lpfc_set_trunking(struct lpfc_hba *phba, char *buff_out)
18691870
if (!mbox)
18701871
return -ENOMEM;
18711872

1873+
payload_len = sizeof(struct lpfc_mbx_set_trunk_mode) -
1874+
sizeof(struct lpfc_sli4_cfg_mhdr);
18721875
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
18731876
LPFC_MBOX_OPCODE_FCOE_FC_SET_TRUNK_MODE,
1874-
12, LPFC_SLI4_MBX_EMBED);
1877+
payload_len, LPFC_SLI4_MBX_EMBED);
18751878

18761879
bf_set(lpfc_mbx_set_trunk_mode,
18771880
&mbox->u.mqe.un.set_trunk_mode,

0 commit comments

Comments
 (0)