SCSI fixes on 20260918

Four driver fixes, three of which are minor and one of which (fnic)
 tries to add some logic to try to avoid MSI-X being ineffective if
 hyperthreading is disabled.  The core fix adds validation to mode sense
 buffer sizes because it is used by ATA and could, theoretically, be
 exploited by a specially crafted USB device that can simply be plugged
 in to any laptop or server.
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iLgEABMIAGAWIQTnYEDbdso9F2cI+arnQslM7pishQUCaq2P/hsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDImHGphbWVzLmJvdHRvbWxleUBoYW5zZW5wYXJ0bmVy
 c2hpcC5jb20ACgkQ50LJTO6YrIXJ6AD9FODcORvjoRDhcU626EWsG/Hoy7YcMH2T
 bZVtZwp3hH8BAPnKar5uj3fCQxJkvI+sLKjiGultTi3llt9VaZGSTFj2
 =JgQF
 -----END PGP SIGNATURE-----

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

Pull SCSI fixes from James Bottomley:
 "Four driver fixes, three of which are minor and one of which (fnic)
  tries to add some logic to try to avoid MSI-X being ineffective if
  hyperthreading is disabled.

  The core fix adds validation to mode sense buffer sizes because it is
  used by ATA and could, theoretically, be exploited by a specially
  crafted USB device that can simply be plugged in to any laptop or
  server"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()
  scsi: fnic: Fix missed link-up when critical IRQ targets offline CPU
  scsi: ibmvfc: Add Kconfig dependency to fix link failure when NVME_FC=m
  scsi: qla2xxx: Fix the ql2xfc2target parameter description
  scsi: pm80xx: Fix the use_msix, use_tasklet and read_wwn parameter descriptions
This commit is contained in:
Linus Torvalds 2026-09-18 13:10:29 -07:00
commit 925724c081
7 changed files with 75 additions and 14 deletions

View File

@ -753,6 +753,7 @@ config SCSI_IBMVFC
tristate "IBM Virtual FC support"
depends on PPC_PSERIES && SCSI
depends on SCSI_FC_ATTRS
depends on NVME_FC || NVME_FC=n
help
This is the IBM POWER Virtual FC Client

View File

@ -31,7 +31,7 @@
#define DRV_NAME "fnic"
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
#define DRV_VERSION "1.9.0.0"
#define DRV_VERSION "1.9.0.1"
#define PFX DRV_NAME ": "
#define DFX DRV_NAME "%d: "

View File

@ -245,7 +245,14 @@ int fnic_set_intr_mode_msix(struct fnic *fnic)
unsigned int m = ARRAY_SIZE(fnic->wq);
unsigned int o = ARRAY_SIZE(fnic->hw_copy_wq);
unsigned int min_irqs = n + m + 1 + 1; /*rq, raw wq, wq, err*/
/*
* Make driver critical vectors unmanaged, or else it can get tied
* to an offline CPU. This can happen when hyper-threading is off.
*/
struct irq_affinity affd = {
.pre_vectors = n + m + 1, /* rq, raw wq, 1 ioq */
.post_vectors = 1, /* err */
};
/*
* We need n RQs, m WQs, o Copy WQs, n+m+o CQs, and n+m+o+1 INTRs
* (last INTR is used for WQ/RQ errors and notification area)
@ -263,8 +270,8 @@ int fnic_set_intr_mode_msix(struct fnic *fnic)
int vec_count = 0;
int vecs = fnic->rq_count + fnic->raw_wq_count + fnic->wq_copy_count + 1;
vec_count = pci_alloc_irq_vectors(fnic->pdev, min_irqs, vecs,
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
vec_count = pci_alloc_irq_vectors_affinity(fnic->pdev, min_irqs,
vecs, PCI_IRQ_MSIX|PCI_IRQ_AFFINITY, &affd);
FNIC_ISR_DBG(KERN_INFO, fnic,
"allocated %d MSI-X vectors\n",
vec_count);

View File

@ -744,8 +744,19 @@ static int fnic_nvme_drv_init(struct fnic *fnic)
return ret;
}
static void fnic_mq_init_queue_map(struct fnic *fnic,
struct blk_mq_queue_map *qmap)
{
unsigned int cpu;
for_each_possible_cpu(cpu)
qmap->mq_map[cpu] = 0;
}
void fnic_mq_map_queues_cpus(struct Scsi_Host *host)
{
const struct cpumask *mask;
unsigned int queue, cpu;
struct fnic *fnic = *((struct fnic **) shost_priv(host));
struct pci_dev *l_pdev = fnic->pdev;
int intr_mode = fnic->config.intr_mode;
@ -766,7 +777,35 @@ void fnic_mq_map_queues_cpus(struct Scsi_Host *host)
return;
}
blk_mq_map_hw_queues(qmap, &l_pdev->dev, FNIC_PCI_OFFSET);
fnic_mq_init_queue_map(fnic, qmap);
/*
* Setup CPU to Queue mapping for all managed MSI-X IRQs.
* Q0 is driver critical and non-managed, hence start from Q1.
*/
for (queue = 1; queue < qmap->nr_queues; queue++) {
int irq_num = pci_irq_vector(fnic->pdev,
queue + FNIC_PCI_OFFSET);
if (irq_num < 0)
continue;
mask = pci_irq_get_affinity(fnic->pdev,
queue + FNIC_PCI_OFFSET);
if (!mask) {
shost_printk(KERN_ERR, host,
"failed to get irq_affinity map for queue:%d\n", irq_num);
continue;
}
FNIC_MAIN_DBG(KERN_INFO, fnic,
"got irq_affinity map for %d:\n", irq_num);
for_each_cpu(cpu, mask) {
qmap->mq_map[cpu] = qmap->queue_offset + queue;
FNIC_MAIN_DBG(KERN_INFO, fnic,
"[Q%d] cpu:%d <=> irq:%d\n",
queue, cpu, irq_num);
}
}
}
static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

View File

@ -58,15 +58,15 @@ MODULE_PARM_DESC(link_rate, "Enable link rate.\n"
bool pm8001_use_msix = true;
module_param_named(use_msix, pm8001_use_msix, bool, 0444);
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");
MODULE_PARM_DESC(use_msix, "Use MSIX interrupts. Default: true");
static bool pm8001_use_tasklet = true;
module_param_named(use_tasklet, pm8001_use_tasklet, bool, 0444);
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");
MODULE_PARM_DESC(use_tasklet, "Use tasklets for interrupt handling. Default: true");
static bool pm8001_read_wwn = true;
module_param_named(read_wwn, pm8001_read_wwn, bool, 0444);
MODULE_PARM_DESC(zoned, "Get WWN from the controller. Default: true");
MODULE_PARM_DESC(read_wwn, "Get WWN from the controller. Default: true");
uint pcs_event_log_severity = 0x03;
module_param(pcs_event_log_severity, int, 0644);

View File

@ -352,7 +352,7 @@ MODULE_PARM_DESC(ql2xnvme_queues,
int ql2xfc2target = 1;
module_param(ql2xfc2target, int, 0444);
MODULE_PARM_DESC(qla2xfc2target,
MODULE_PARM_DESC(ql2xfc2target,
"Enables FC2 Target support. "
"0 - FC2 Target support is disabled. "
"1 - FC2 Target support is enabled (default).");

View File

@ -727,6 +727,7 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable)
struct scsi_mode_data data;
struct scsi_sense_hdr sshdr;
char *buf_data;
size_t avail, offset;
int len;
ret = scsi_mode_sense(sdev, 0x08, 0x0a, 0xf2, buf, sizeof(buf),
@ -735,11 +736,24 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable)
return -EINVAL;
/* Enable or disable CDL using the ATA feature page */
len = min_t(size_t, sizeof(buf),
data.length - data.header_length -
data.block_descriptor_length);
buf_data = buf + data.header_length +
data.block_descriptor_length;
avail = min_t(size_t, data.length, sizeof(buf));
if (data.header_length > avail)
return -EINVAL;
offset = data.header_length;
avail -= data.header_length;
if (data.block_descriptor_length > avail)
return -EINVAL;
offset += data.block_descriptor_length;
avail -= data.block_descriptor_length;
if (avail < 5)
return -EINVAL;
buf_data = buf + offset;
len = avail;
/*
* If we want to enable CDL and CDL is already enabled on the