Skip to content

Commit

Permalink
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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
  • Loading branch information
Linus Torvalds committed May 3, 2018
2 parents 2d618bd + f5957da commit 3b6f979
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions drivers/scsi/isci/port_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
* Note: We have not moved the current phy_index so we will actually
* compare the startting phy with itself.
* This is expected and required to add the phy to the port. */
while (phy_index < SCI_MAX_PHYS) {
for (; phy_index < SCI_MAX_PHYS; phy_index++) {
if ((phy_mask & (1 << phy_index)) == 0)
continue;
sci_phy_get_sas_address(&ihost->phys[phy_index],
Expand All @@ -311,7 +311,6 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
&ihost->phys[phy_index]);

assigned_phy_mask |= (1 << phy_index);
phy_index++;
}

}
Expand Down
7 changes: 5 additions & 2 deletions drivers/scsi/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1722,11 +1722,14 @@ static int storvsc_probe(struct hv_device *device,
max_targets = STORVSC_MAX_TARGETS;
max_channels = STORVSC_MAX_CHANNELS;
/*
* On Windows8 and above, we support sub-channels for storage.
* On Windows8 and above, we support sub-channels for storage
* on SCSI and FC controllers.
* The number of sub-channels offerred is based on the number of
* VCPUs in the guest.
*/
max_sub_channels = (num_cpus / storvsc_vcpus_per_sub_channel);
if (!dev_is_ide)
max_sub_channels =
(num_cpus - 1) / storvsc_vcpus_per_sub_channel;
}

scsi_driver.can_queue = (max_outstanding_req_per_channel *
Expand Down
8 changes: 4 additions & 4 deletions drivers/target/target_core_iblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
{
struct se_device *dev = cmd->se_dev;
struct scatterlist *sg = &cmd->t_data_sg[0];
unsigned char *buf, zero = 0x00, *p = &zero;
int rc, ret;
unsigned char *buf, *not_zero;
int ret;

buf = kmap(sg_page(sg)) + sg->offset;
if (!buf)
Expand All @@ -437,10 +437,10 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
* Fall back to block_execute_write_same() slow-path if
* incoming WRITE_SAME payload does not contain zeros.
*/
rc = memcmp(buf, p, cmd->data_length);
not_zero = memchr_inv(buf, 0x00, cmd->data_length);
kunmap(sg_page(sg));

if (rc)
if (not_zero)
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;

ret = blkdev_issue_zeroout(bdev,
Expand Down

0 comments on commit 3b6f979

Please sign in to comment.