Commit 6e6d0536 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Seven fixes to four drivers with no core changes.

  The mpt3sas one is theoretical until we get a CPU that goes up to 64
  bits physical, the qla2xxx one fixes an oops in a driver
  initialization error leg and the others are mostly cosmetic"

[ The fcoe patches may be worth highlighting - they may be "just"
  cleanups, but they simplify and fix the odd fc_rport_priv structure
  handling rules so that the new gcc-9 warnings about memset crossing
  structure boundaries are gone.

  The old code was hard for humans to understand too, and really
  confused the compiler sanity checks  - Linus ]

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: qla2xxx: Fix possible fcport null-pointer dereferences
  scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA
  scsi: hpsa: remove printing internal cdb on tag collision
  scsi: hpsa: correct scsi command status issue after reset
  scsi: fcoe: pass in fcoe_rport structure instead of fc_rport_priv
  scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure
  scsi: libfc: Whitespace cleanup in libfc.h
parents 10e5ddd7 e82f04ec
This diff is collapsed.
...@@ -2334,6 +2334,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h, ...@@ -2334,6 +2334,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
case IOACCEL2_SERV_RESPONSE_COMPLETE: case IOACCEL2_SERV_RESPONSE_COMPLETE:
switch (c2->error_data.status) { switch (c2->error_data.status) {
case IOACCEL2_STATUS_SR_TASK_COMP_GOOD: case IOACCEL2_STATUS_SR_TASK_COMP_GOOD:
if (cmd)
cmd->result = 0;
break; break;
case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND: case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND:
cmd->result |= SAM_STAT_CHECK_CONDITION; cmd->result |= SAM_STAT_CHECK_CONDITION;
...@@ -2483,8 +2485,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h, ...@@ -2483,8 +2485,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
/* check for good status */ /* check for good status */
if (likely(c2->error_data.serv_response == 0 && if (likely(c2->error_data.serv_response == 0 &&
c2->error_data.status == 0)) c2->error_data.status == 0)) {
cmd->result = 0;
return hpsa_cmd_free_and_done(h, c, cmd); return hpsa_cmd_free_and_done(h, c, cmd);
}
/* /*
* Any RAID offload error results in retry which will use * Any RAID offload error results in retry which will use
...@@ -5653,6 +5657,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) ...@@ -5653,6 +5657,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
if (c == NULL) if (c == NULL)
return SCSI_MLQUEUE_DEVICE_BUSY; return SCSI_MLQUEUE_DEVICE_BUSY;
/*
* This is necessary because the SML doesn't zero out this field during
* error recovery.
*/
cmd->result = 0;
/* /*
* Call alternate submit routine for I/O accelerated commands. * Call alternate submit routine for I/O accelerated commands.
* Retries always go down the normal I/O path. * Retries always go down the normal I/O path.
...@@ -6081,8 +6091,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h, ...@@ -6081,8 +6091,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
if (idx != h->last_collision_tag) { /* Print once per tag */ if (idx != h->last_collision_tag) { /* Print once per tag */
dev_warn(&h->pdev->dev, dev_warn(&h->pdev->dev,
"%s: tag collision (tag=%d)\n", __func__, idx); "%s: tag collision (tag=%d)\n", __func__, idx);
if (c->scsi_cmd != NULL)
scsi_print_command(c->scsi_cmd);
if (scmd) if (scmd)
scsi_print_command(scmd); scsi_print_command(scmd);
h->last_collision_tag = idx; h->last_collision_tag = idx;
......
...@@ -128,6 +128,7 @@ EXPORT_SYMBOL(fc_rport_lookup); ...@@ -128,6 +128,7 @@ EXPORT_SYMBOL(fc_rport_lookup);
struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
{ {
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
size_t rport_priv_size = sizeof(*rdata);
lockdep_assert_held(&lport->disc.disc_mutex); lockdep_assert_held(&lport->disc.disc_mutex);
...@@ -135,7 +136,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) ...@@ -135,7 +136,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
if (rdata) if (rdata)
return rdata; return rdata;
rdata = kzalloc(sizeof(*rdata) + lport->rport_priv_size, GFP_KERNEL); if (lport->rport_priv_size > 0)
rport_priv_size = lport->rport_priv_size;
rdata = kzalloc(rport_priv_size, GFP_KERNEL);
if (!rdata) if (!rdata)
return NULL; return NULL;
......
...@@ -2703,6 +2703,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2703,6 +2703,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
{ {
u64 required_mask, coherent_mask; u64 required_mask, coherent_mask;
struct sysinfo s; struct sysinfo s;
/* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */
int dma_mask = (ioc->hba_mpi_version_belonged > MPI2_VERSION) ? 63 : 64;
if (ioc->is_mcpu_endpoint) if (ioc->is_mcpu_endpoint)
goto try_32bit; goto try_32bit;
...@@ -2712,17 +2714,17 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2712,17 +2714,17 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
goto try_32bit; goto try_32bit;
if (ioc->dma_mask) if (ioc->dma_mask)
coherent_mask = DMA_BIT_MASK(64); coherent_mask = DMA_BIT_MASK(dma_mask);
else else
coherent_mask = DMA_BIT_MASK(32); coherent_mask = DMA_BIT_MASK(32);
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) || if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_mask)) ||
dma_set_coherent_mask(&pdev->dev, coherent_mask)) dma_set_coherent_mask(&pdev->dev, coherent_mask))
goto try_32bit; goto try_32bit;
ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->base_add_sg_single = &_base_add_sg_single_64;
ioc->sge_size = sizeof(Mpi2SGESimple64_t); ioc->sge_size = sizeof(Mpi2SGESimple64_t);
ioc->dma_mask = 64; ioc->dma_mask = dma_mask;
goto out; goto out;
try_32bit: try_32bit:
...@@ -2744,7 +2746,7 @@ static int ...@@ -2744,7 +2746,7 @@ static int
_base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc, _base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc,
struct pci_dev *pdev) struct pci_dev *pdev)
{ {
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(ioc->dma_mask))) {
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
return -ENODEV; return -ENODEV;
} }
...@@ -4989,7 +4991,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4989,7 +4991,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
total_sz += sz; total_sz += sz;
} while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
if (ioc->dma_mask == 64) { if (ioc->dma_mask > 32) {
if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {
ioc_warn(ioc, "no suitable consistent DMA mask for %s\n", ioc_warn(ioc, "no suitable consistent DMA mask for %s\n",
pci_name(ioc->pdev)); pci_name(ioc->pdev));
......
...@@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) ...@@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
ql_log(ql_log_warn, vha, 0xd049, ql_log(ql_log_warn, vha, 0xd049,
"Failed to allocate ct_sns request.\n"); "Failed to allocate ct_sns request.\n");
kfree(fcport); kfree(fcport);
fcport = NULL; return NULL;
} }
INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn);
......
...@@ -229,6 +229,7 @@ struct fcoe_fcf { ...@@ -229,6 +229,7 @@ struct fcoe_fcf {
* @vn_mac: VN_Node assigned MAC address for data * @vn_mac: VN_Node assigned MAC address for data
*/ */
struct fcoe_rport { struct fcoe_rport {
struct fc_rport_priv rdata;
unsigned long time; unsigned long time;
u16 fcoe_len; u16 fcoe_len;
u16 flags; u16 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment