Skip to content

Commit df6cbc6

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Two small fixes to the mpi3mr driver. One to avoid oversize allocations in tracing and the other to fix an uninitialized spinlock in the user to driver feature request code (used to trigger dumps and the like)" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: mpi3mr: Avoid MAX_PAGE_ORDER WARNING for buffer allocations scsi: mpi3mr: Add missing spin_lock_init() for mrioc->trigger_lock
2 parents d09840f + 8c6b808 commit df6cbc6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ void mpi3mr_alloc_diag_bufs(struct mpi3mr_ioc *mrioc)
100100
dprint_init(mrioc,
101101
"trying to allocate trace diag buffer of size = %dKB\n",
102102
trace_size / 1024);
103-
if (mpi3mr_alloc_trace_buffer(mrioc, trace_size)) {
103+
if (get_order(trace_size) > MAX_PAGE_ORDER ||
104+
mpi3mr_alloc_trace_buffer(mrioc, trace_size)) {
104105
retry = true;
105106
trace_size -= trace_dec_size;
106107
dprint_init(mrioc, "trace diag buffer allocation failed\n"
@@ -118,8 +119,12 @@ void mpi3mr_alloc_diag_bufs(struct mpi3mr_ioc *mrioc)
118119
diag_buffer->type = MPI3_DIAG_BUFFER_TYPE_FW;
119120
diag_buffer->status = MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED;
120121
if ((mrioc->facts.diag_fw_sz < fw_size) && (fw_size >= fw_min_size)) {
121-
diag_buffer->addr = dma_alloc_coherent(&mrioc->pdev->dev,
122-
fw_size, &diag_buffer->dma_addr, GFP_KERNEL);
122+
if (get_order(fw_size) <= MAX_PAGE_ORDER) {
123+
diag_buffer->addr
124+
= dma_alloc_coherent(&mrioc->pdev->dev, fw_size,
125+
&diag_buffer->dma_addr,
126+
GFP_KERNEL);
127+
}
123128
if (!retry)
124129
dprint_init(mrioc,
125130
"%s:trying to allocate firmware diag buffer of size = %dKB\n",

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5234,6 +5234,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
52345234
spin_lock_init(&mrioc->watchdog_lock);
52355235
spin_lock_init(&mrioc->chain_buf_lock);
52365236
spin_lock_init(&mrioc->sas_node_lock);
5237+
spin_lock_init(&mrioc->trigger_lock);
52375238

52385239
INIT_LIST_HEAD(&mrioc->fwevt_list);
52395240
INIT_LIST_HEAD(&mrioc->tgtdev_list);

0 commit comments

Comments
 (0)