aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-05-02 22:38:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-05-02 22:38:17 -0400
commit3b6f979319c86d73c48d27deca68331e7924c209 (patch)
tree17426059eec54888c2e940094aae9a28f1a0cc7f
parent2d618bdf71635463a4aa4ad0fe46ec852292bc0c (diff)
parentf5957dade4f373b04fa1f5315a489f18cc2c4cb4 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Three small bug fixes: an illegally overlapping memcmp in target code, a potential infinite loop in isci under certain rare phy conditions and an ATA queue depth (performance) correction for storvsc" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: target: Fix fortify_panic kernel exception scsi: isci: Fix infinite loop in while loop scsi: storvsc: Set up correct queue depth values for IDE devices
-rw-r--r--drivers/scsi/isci/port_config.c3
-rw-r--r--drivers/scsi/storvsc_drv.c7
-rw-r--r--drivers/target/target_core_iblock.c8
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c
index edb7be786c65..9e8de1462593 100644
--- a/drivers/scsi/isci/port_config.c
+++ b/drivers/scsi/isci/port_config.c
@@ -291,7 +291,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
291 * Note: We have not moved the current phy_index so we will actually 291 * Note: We have not moved the current phy_index so we will actually
292 * compare the startting phy with itself. 292 * compare the startting phy with itself.
293 * This is expected and required to add the phy to the port. */ 293 * This is expected and required to add the phy to the port. */
294 while (phy_index < SCI_MAX_PHYS) { 294 for (; phy_index < SCI_MAX_PHYS; phy_index++) {
295 if ((phy_mask & (1 << phy_index)) == 0) 295 if ((phy_mask & (1 << phy_index)) == 0)
296 continue; 296 continue;
297 sci_phy_get_sas_address(&ihost->phys[phy_index], 297 sci_phy_get_sas_address(&ihost->phys[phy_index],
@@ -311,7 +311,6 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
311 &ihost->phys[phy_index]); 311 &ihost->phys[phy_index]);
312 312
313 assigned_phy_mask |= (1 << phy_index); 313 assigned_phy_mask |= (1 << phy_index);
314 phy_index++;
315 } 314 }
316 315
317 } 316 }
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 8c51d628b52e..a2ec0bc9e9fa 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1722,11 +1722,14 @@ static int storvsc_probe(struct hv_device *device,
1722 max_targets = STORVSC_MAX_TARGETS; 1722 max_targets = STORVSC_MAX_TARGETS;
1723 max_channels = STORVSC_MAX_CHANNELS; 1723 max_channels = STORVSC_MAX_CHANNELS;
1724 /* 1724 /*
1725 * On Windows8 and above, we support sub-channels for storage. 1725 * On Windows8 and above, we support sub-channels for storage
1726 * on SCSI and FC controllers.
1726 * The number of sub-channels offerred is based on the number of 1727 * The number of sub-channels offerred is based on the number of
1727 * VCPUs in the guest. 1728 * VCPUs in the guest.
1728 */ 1729 */
1729 max_sub_channels = (num_cpus / storvsc_vcpus_per_sub_channel); 1730 if (!dev_is_ide)
1731 max_sub_channels =
1732 (num_cpus - 1) / storvsc_vcpus_per_sub_channel;
1730 } 1733 }
1731 1734
1732 scsi_driver.can_queue = (max_outstanding_req_per_channel * 1735 scsi_driver.can_queue = (max_outstanding_req_per_channel *
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 07c814c42648..60429011292a 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -427,8 +427,8 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
427{ 427{
428 struct se_device *dev = cmd->se_dev; 428 struct se_device *dev = cmd->se_dev;
429 struct scatterlist *sg = &cmd->t_data_sg[0]; 429 struct scatterlist *sg = &cmd->t_data_sg[0];
430 unsigned char *buf, zero = 0x00, *p = &zero; 430 unsigned char *buf, *not_zero;
431 int rc, ret; 431 int ret;
432 432
433 buf = kmap(sg_page(sg)) + sg->offset; 433 buf = kmap(sg_page(sg)) + sg->offset;
434 if (!buf) 434 if (!buf)
@@ -437,10 +437,10 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
437 * Fall back to block_execute_write_same() slow-path if 437 * Fall back to block_execute_write_same() slow-path if
438 * incoming WRITE_SAME payload does not contain zeros. 438 * incoming WRITE_SAME payload does not contain zeros.
439 */ 439 */
440 rc = memcmp(buf, p, cmd->data_length); 440 not_zero = memchr_inv(buf, 0x00, cmd->data_length);
441 kunmap(sg_page(sg)); 441 kunmap(sg_page(sg));
442 442
443 if (rc) 443 if (not_zero)
444 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 444 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
445 445
446 ret = blkdev_issue_zeroout(bdev, 446 ret = blkdev_issue_zeroout(bdev,