Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88ec63d6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more SCSI changes from James Bottomley:
 "This is a small set of updates which missed the first pull.  It's more
  msix updates, some iscsi and qla4xxx fixes, we also have some string
  null termination fixes a return value fix and a couple of pm8001
  firmware fixes.

  Just a note, we do have a couple of bug fixes coming under separate
  cover, but they don't have to be part of the merge window"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  iscsi class: Fix freeing of skb in get host error path
  scsi: fix u14-34f printk format warnings
  pm8001: fix pm8001_store_update_fw
  pm8001: Fix erratic calculation in update_flash
  pm8001: Update MAINTAINERS list
  libiscsi: return new error code when nop times out
  iscsi class: fix get_host_stats return code when not supported
  iscsi class: fix get_host_stats error handling
  qla4xxx: fix get_host_stats error propagation
  qla4xxx: check the return value of dma_alloc_coherent()
  scsi: qla4xxx: ql4_mbx.c: Cleaning up missing null-terminate in conjunction with strncpy
  scsi: qla4xxx: ql4_os.c: Cleaning up missing null-terminate in conjunction with strncpy
  qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()
parents 2f39691f ae87e8b2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7059,6 +7059,7 @@ F: drivers/scsi/pmcraid.*
PMC SIERRA PM8001 DRIVER
M:	xjtuwjp@gmail.com
M:	lindar_liu@usish.com
L:	pmchba@pmcs.com
L:	linux-scsi@vger.kernel.org
S:	Supported
F:	drivers/scsi/pm8001/
+1 −1
Original line number Diff line number Diff line
@@ -2097,7 +2097,7 @@ static void iscsi_check_transport_timeouts(unsigned long data)
				  conn->ping_timeout, conn->recv_timeout,
				  last_recv, conn->last_ping, jiffies);
		spin_unlock(&session->frwd_lock);
		iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
		iscsi_conn_failure(conn, ISCSI_ERR_NOP_TIMEDOUT);
		return;
	}

+70 −74
Original line number Diff line number Diff line
@@ -526,18 +526,19 @@ static int pm8001_set_nvmd(struct pm8001_hba_info *pm8001_ha)
{
	struct pm8001_ioctl_payload	*payload;
	DECLARE_COMPLETION_ONSTACK(completion);
	u8		*ioctlbuffer = NULL;
	u32		length = 0;
	u32		ret = 0;
	u8		*ioctlbuffer;
	u32		ret;
	u32		length = 1024 * 5 + sizeof(*payload) - 1;

	if (pm8001_ha->fw_image->size > 4096) {
		pm8001_ha->fw_status = FAIL_FILE_SIZE;
		return -EFAULT;
	}

	length = 1024 * 5 + sizeof(*payload) - 1;
	ioctlbuffer = kzalloc(length, GFP_KERNEL);
	if (!ioctlbuffer)
	if (!ioctlbuffer) {
		pm8001_ha->fw_status = FAIL_OUT_MEMORY;
		return -ENOMEM;
	if ((pm8001_ha->fw_image->size <= 0) ||
	    (pm8001_ha->fw_image->size > 4096)) {
		ret = FAIL_FILE_SIZE;
		goto out;
	}
	payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
	memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data,
@@ -547,6 +548,10 @@ static int pm8001_set_nvmd(struct pm8001_hba_info *pm8001_ha)
	payload->minor_function = 0x1;
	pm8001_ha->nvmd_completion = &completion;
	ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload);
	if (ret) {
		pm8001_ha->fw_status = FAIL_OUT_MEMORY;
		goto out;
	}
	wait_for_completion(&completion);
out:
	kfree(ioctlbuffer);
@@ -557,35 +562,31 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
{
	struct pm8001_ioctl_payload	*payload;
	DECLARE_COMPLETION_ONSTACK(completion);
	u8		*ioctlbuffer = NULL;
	u32		length = 0;
	u8		*ioctlbuffer;
	struct fw_control_info	*fwControl;
	u32		loopNumber, loopcount = 0;
	u32		sizeRead = 0;
	u32		partitionSize, partitionSizeTmp;
	u32		ret = 0;
	u32		partitionNumber = 0;
	u32		loopNumber, loopcount;
	struct pm8001_fw_image_header *image_hdr;
	u32		sizeRead = 0;
	u32		ret = 0;
	u32		length = 1024 * 16 + sizeof(*payload) - 1;

	length = 1024 * 16 + sizeof(*payload) - 1;
	if (pm8001_ha->fw_image->size < 28) {
		pm8001_ha->fw_status = FAIL_FILE_SIZE;
		return -EFAULT;
	}
	ioctlbuffer = kzalloc(length, GFP_KERNEL);
	image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data;
	if (!ioctlbuffer)
	if (!ioctlbuffer) {
		pm8001_ha->fw_status = FAIL_OUT_MEMORY;
		return -ENOMEM;
	if (pm8001_ha->fw_image->size < 28) {
		ret = FAIL_FILE_SIZE;
		goto out;
	}

	image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data;
	while (sizeRead < pm8001_ha->fw_image->size) {
		partitionSizeTmp =
			*(u32 *)((u8 *)&image_hdr->image_length + sizeRead);
		partitionSize = be32_to_cpu(partitionSizeTmp);
		loopcount = (partitionSize + HEADER_LEN)/IOCTL_BUF_SIZE;
		if (loopcount % IOCTL_BUF_SIZE)
			loopcount++;
		if (loopcount == 0)
			loopcount++;
		loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN,
					IOCTL_BUF_SIZE);
		for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
			payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
			payload->length = 1024*16;
@@ -617,17 +618,17 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)

		pm8001_ha->nvmd_completion = &completion;
		ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload);
		if (ret)
			break;
		if (ret) {
			pm8001_ha->fw_status = FAIL_OUT_MEMORY;
			goto out;
		}
		wait_for_completion(&completion);
		if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) {
			ret = fwControl->retcode;
			break;
			pm8001_ha->fw_status = fwControl->retcode;
			ret = -EFAULT;
			goto out;
		}
		}
	if (ret)
		break;
	partitionNumber++;
	}
out:
	kfree(ioctlbuffer);
@@ -643,22 +644,29 @@ static ssize_t pm8001_store_update_fw(struct device *cdev,
	char *cmd_ptr, *filename_ptr;
	int res, i;
	int flash_command = FLASH_CMD_NONE;
	int err = 0;
	int ret;

	if (!capable(CAP_SYS_ADMIN))
		return -EACCES;

	cmd_ptr = kzalloc(count*2, GFP_KERNEL);
	/* this test protects us from running two flash processes at once,
	 * so we should start with this test */
	if (pm8001_ha->fw_status == FLASH_IN_PROGRESS)
		return -EINPROGRESS;
	pm8001_ha->fw_status = FLASH_IN_PROGRESS;

	cmd_ptr = kzalloc(count*2, GFP_KERNEL);
	if (!cmd_ptr) {
		err = FAIL_OUT_MEMORY;
		goto out;
		pm8001_ha->fw_status = FAIL_OUT_MEMORY;
		return -ENOMEM;
	}

	filename_ptr = cmd_ptr + count;
	res = sscanf(buf, "%s %s", cmd_ptr, filename_ptr);
	if (res != 2) {
		err = FAIL_PARAMETERS;
		goto out1;
		pm8001_ha->fw_status = FAIL_PARAMETERS;
		ret = -EINVAL;
		goto out;
	}

	for (i = 0; flash_command_table[i].code != FLASH_CMD_NONE; i++) {
@@ -669,50 +677,38 @@ static ssize_t pm8001_store_update_fw(struct device *cdev,
		}
	}
	if (flash_command == FLASH_CMD_NONE) {
		err = FAIL_PARAMETERS;
		goto out1;
		pm8001_ha->fw_status = FAIL_PARAMETERS;
		ret = -EINVAL;
		goto out;
	}

	if (pm8001_ha->fw_status == FLASH_IN_PROGRESS) {
		err = FLASH_IN_PROGRESS;
		goto out1;
	}
	err = request_firmware(&pm8001_ha->fw_image,
	ret = request_firmware(&pm8001_ha->fw_image,
			       filename_ptr,
			       pm8001_ha->dev);

	if (err) {
	if (ret) {
		PM8001_FAIL_DBG(pm8001_ha,
			pm8001_printk("Failed to load firmware image file %s,"
			" error %d\n", filename_ptr, err));
		err = FAIL_OPEN_BIOS_FILE;
		goto out1;
			pm8001_printk(
			"Failed to load firmware image file %s,	error %d\n",
			filename_ptr, ret));
		pm8001_ha->fw_status = FAIL_OPEN_BIOS_FILE;
		goto out;
	}

	switch (flash_command) {
	case FLASH_CMD_UPDATE:
		pm8001_ha->fw_status = FLASH_IN_PROGRESS;
		err = pm8001_update_flash(pm8001_ha);
		break;
	case FLASH_CMD_SET_NVMD:
		pm8001_ha->fw_status = FLASH_IN_PROGRESS;
		err = pm8001_set_nvmd(pm8001_ha);
		break;
	default:
		pm8001_ha->fw_status = FAIL_PARAMETERS;
		err = FAIL_PARAMETERS;
		break;
	}
	if (FLASH_CMD_UPDATE == flash_command)
		ret = pm8001_update_flash(pm8001_ha);
	else
		ret = pm8001_set_nvmd(pm8001_ha);

	release_firmware(pm8001_ha->fw_image);
out1:
	kfree(cmd_ptr);
out:
	pm8001_ha->fw_status = err;
	kfree(cmd_ptr);

	if (ret)
		return ret;

	if (!err)
	pm8001_ha->fw_status = FLASH_OK;
	return count;
	else
		return -err;
}

static ssize_t pm8001_show_update_fw(struct device *cdev,
+2 −2
Original line number Diff line number Diff line
@@ -4824,7 +4824,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha,
	rc = pm8001_tag_alloc(pm8001_ha, &tag);
	if (rc) {
		kfree(fw_control_context);
		return rc;
		return -EBUSY;
	}
	ccb = &pm8001_ha->ccb_info[tag];
	ccb->fw_control_context = fw_control_context;
@@ -4946,7 +4946,7 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
	rc = pm8001_tag_alloc(pm8001_ha, &tag);
	if (rc) {
		kfree(fw_control_context);
		return rc;
		return -EBUSY;
	}
	ccb = &pm8001_ha->ccb_info[tag];
	ccb->fw_control_context = fw_control_context;
+20 −19
Original line number Diff line number Diff line
@@ -748,15 +748,16 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
		sizeof(pm8001_ha->msix_entries[0]);
	for (i = 0; i < max_entry ; i++)
		pm8001_ha->msix_entries[i].entry = i;
	rc = pci_enable_msix(pm8001_ha->pdev, pm8001_ha->msix_entries,
	rc = pci_enable_msix_exact(pm8001_ha->pdev, pm8001_ha->msix_entries,
		number_of_intr);
	pm8001_ha->number_of_intr = number_of_intr;
	if (!rc) {
	if (rc)
		return rc;

	PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
			"pci_enable_msix request ret:%d no of intr %d\n",
		"pci_enable_msix_exact request ret:%d no of intr %d\n",
				rc, pm8001_ha->number_of_intr));


	for (i = 0; i < number_of_intr; i++) {
		snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
				DRV_NAME"%d", i);
@@ -767,15 +768,15 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
			pm8001_interrupt_handler_msix, flag,
			intr_drvname[i], &(pm8001_ha->irq_vector[i]));
		if (rc) {
				for (j = 0; j < i; j++)
					free_irq(
					pm8001_ha->msix_entries[j].vector,
			for (j = 0; j < i; j++) {
				free_irq(pm8001_ha->msix_entries[j].vector,
					&(pm8001_ha->irq_vector[i]));
			}
			pci_disable_msix(pm8001_ha->pdev);
			break;
		}
	}
	}

	return rc;
}
#endif
Loading