Skip to content

Commit b83d543

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[SCSI] be2iscsi: fix dma free size mismatch regression
This patch should go into 3.5 fixes. The bug was added in the patches for the 3.5 feature window. As you can see from the patch I made a mistake. During development I switched from passing a struct to the size of the struct, but left the sizeof. This results in us allocating 4 bytes (sizeof(int)) but then calling pci_free_consistent with the size of the struct. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 356293b commit b83d543

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/scsi/be2iscsi/be_mgmt.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,12 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
571571
static int mgmt_alloc_cmd_data(struct beiscsi_hba *phba, struct be_dma_mem *cmd,
572572
int iscsi_cmd, int size)
573573
{
574-
cmd->va = pci_alloc_consistent(phba->ctrl.pdev, sizeof(size),
575-
&cmd->dma);
574+
cmd->va = pci_alloc_consistent(phba->ctrl.pdev, size, &cmd->dma);
576575
if (!cmd->va) {
577576
SE_DEBUG(DBG_LVL_1, "Failed to allocate memory for if info\n");
578577
return -ENOMEM;
579578
}
580-
memset(cmd->va, 0, sizeof(size));
579+
memset(cmd->va, 0, size);
581580
cmd->size = size;
582581
be_cmd_hdr_prepare(cmd->va, CMD_SUBSYSTEM_ISCSI, iscsi_cmd, size);
583582
return 0;

0 commit comments

Comments
 (0)