Skip to content

Commit 66cc544

Browse files
committed
Merge tag 'dmaengine-fix-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine
Pull dmaengine fixes from Vinod Koul: - kmemleak, error path handling and missing kmem_cache_destroy() fixes for ioatdma driver - use after free fix for idxd driver - data synchronisation fix for xdma isr handling - fsl driver channel constraints and linking two fsl module fixes * tag 'dmaengine-fix-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: dmaengine: ioatdma: Fix missing kmem_cache_destroy() dt-bindings: dma: fsl-edma: fix dma-channels constraints dmaengine: fsl-edma: avoid linking both modules dmaengine: ioatdma: Fix kmemleak in ioat_pci_probe() dmaengine: ioatdma: Fix error path in ioat3_dma_probe() dmaengine: ioatdma: Fix leaking on version mismatch dmaengine: ti: k3-udma-glue: Fix of_k3_udma_glue_parse_chn_by_id() dmaengine: idxd: Fix possible Use-After-Free in irq_process_work_list dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
2 parents a21b52a + 5422145 commit 66cc544

File tree

6 files changed

+39
-35
lines changed

6 files changed

+39
-35
lines changed

Documentation/devicetree/bindings/dma/fsl,edma.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ properties:
5959
- 3
6060

6161
dma-channels:
62-
minItems: 1
63-
maxItems: 64
62+
minimum: 1
63+
maximum: 64
6464

6565
clocks:
6666
minItems: 1

drivers/dma/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ config LS2X_APB_DMA
394394

395395
config MCF_EDMA
396396
tristate "Freescale eDMA engine support, ColdFire mcf5441x SoCs"
397-
depends on M5441x || COMPILE_TEST
397+
depends on M5441x || (COMPILE_TEST && FSL_EDMA=n)
398398
select DMA_ENGINE
399399
select DMA_VIRTUAL_CHANNELS
400400
help

drivers/dma/idxd/irq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,13 @@ static void irq_process_work_list(struct idxd_irq_entry *irq_entry)
611611

612612
spin_unlock(&irq_entry->list_lock);
613613

614-
list_for_each_entry(desc, &flist, list) {
614+
list_for_each_entry_safe(desc, n, &flist, list) {
615615
/*
616616
* Check against the original status as ABORT is software defined
617617
* and 0xff, which DSA_COMP_STATUS_MASK can mask out.
618618
*/
619+
list_del(&desc->list);
620+
619621
if (unlikely(desc->completion->status == IDXD_COMP_DESC_ABORT)) {
620622
idxd_desc_complete(desc, IDXD_COMPLETE_ABORT, true);
621623
continue;

drivers/dma/ioat/init.c

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,6 @@ static int ioat_probe(struct ioatdma_device *ioat_dma)
534534
return err;
535535
}
536536

537-
static int ioat_register(struct ioatdma_device *ioat_dma)
538-
{
539-
int err = dma_async_device_register(&ioat_dma->dma_dev);
540-
541-
if (err) {
542-
ioat_disable_interrupts(ioat_dma);
543-
dma_pool_destroy(ioat_dma->completion_pool);
544-
}
545-
546-
return err;
547-
}
548-
549537
static void ioat_dma_remove(struct ioatdma_device *ioat_dma)
550538
{
551539
struct dma_device *dma = &ioat_dma->dma_dev;
@@ -1181,9 +1169,9 @@ static int ioat3_dma_probe(struct ioatdma_device *ioat_dma, int dca)
11811169
ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
11821170
}
11831171

1184-
err = ioat_register(ioat_dma);
1172+
err = dma_async_device_register(&ioat_dma->dma_dev);
11851173
if (err)
1186-
return err;
1174+
goto err_disable_interrupts;
11871175

11881176
ioat_kobject_add(ioat_dma, &ioat_ktype);
11891177

@@ -1192,20 +1180,29 @@ static int ioat3_dma_probe(struct ioatdma_device *ioat_dma, int dca)
11921180

11931181
/* disable relaxed ordering */
11941182
err = pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &val16);
1195-
if (err)
1196-
return pcibios_err_to_errno(err);
1183+
if (err) {
1184+
err = pcibios_err_to_errno(err);
1185+
goto err_disable_interrupts;
1186+
}
11971187

11981188
/* clear relaxed ordering enable */
11991189
val16 &= ~PCI_EXP_DEVCTL_RELAX_EN;
12001190
err = pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, val16);
1201-
if (err)
1202-
return pcibios_err_to_errno(err);
1191+
if (err) {
1192+
err = pcibios_err_to_errno(err);
1193+
goto err_disable_interrupts;
1194+
}
12031195

12041196
if (ioat_dma->cap & IOAT_CAP_DPS)
12051197
writeb(ioat_pending_level + 1,
12061198
ioat_dma->reg_base + IOAT_PREFETCH_LIMIT_OFFSET);
12071199

12081200
return 0;
1201+
1202+
err_disable_interrupts:
1203+
ioat_disable_interrupts(ioat_dma);
1204+
dma_pool_destroy(ioat_dma->completion_pool);
1205+
return err;
12091206
}
12101207

12111208
static void ioat_shutdown(struct pci_dev *pdev)
@@ -1350,6 +1347,8 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13501347
void __iomem * const *iomap;
13511348
struct device *dev = &pdev->dev;
13521349
struct ioatdma_device *device;
1350+
unsigned int i;
1351+
u8 version;
13531352
int err;
13541353

13551354
err = pcim_enable_device(pdev);
@@ -1363,6 +1362,10 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13631362
if (!iomap)
13641363
return -ENOMEM;
13651364

1365+
version = readb(iomap[IOAT_MMIO_BAR] + IOAT_VER_OFFSET);
1366+
if (version < IOAT_VER_3_0)
1367+
return -ENODEV;
1368+
13661369
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
13671370
if (err)
13681371
return err;
@@ -1373,17 +1376,18 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13731376
pci_set_master(pdev);
13741377
pci_set_drvdata(pdev, device);
13751378

1376-
device->version = readb(device->reg_base + IOAT_VER_OFFSET);
1379+
device->version = version;
13771380
if (device->version >= IOAT_VER_3_4)
13781381
ioat_dca_enabled = 0;
1379-
if (device->version >= IOAT_VER_3_0) {
1380-
if (is_skx_ioat(pdev))
1381-
device->version = IOAT_VER_3_2;
1382-
err = ioat3_dma_probe(device, ioat_dca_enabled);
1383-
} else
1384-
return -ENODEV;
13851382

1383+
if (is_skx_ioat(pdev))
1384+
device->version = IOAT_VER_3_2;
1385+
1386+
err = ioat3_dma_probe(device, ioat_dca_enabled);
13861387
if (err) {
1388+
for (i = 0; i < IOAT_MAX_CHANS; i++)
1389+
kfree(device->idx[i]);
1390+
kfree(device);
13871391
dev_err(dev, "Intel(R) I/OAT DMA Engine init failed\n");
13881392
return -ENODEV;
13891393
}
@@ -1445,6 +1449,7 @@ module_init(ioat_init_module);
14451449
static void __exit ioat_exit_module(void)
14461450
{
14471451
pci_unregister_driver(&ioat_pci_driver);
1452+
kmem_cache_destroy(ioat_sed_cache);
14481453
kmem_cache_destroy(ioat_cache);
14491454
}
14501455
module_exit(ioat_exit_module);

drivers/dma/ti/k3-udma-glue.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,9 @@ of_k3_udma_glue_parse_chn_by_id(struct device_node *udmax_np, struct k3_udma_glu
200200

201201
ret = of_k3_udma_glue_parse(udmax_np, common);
202202
if (ret)
203-
goto out_put_spec;
203+
return ret;
204204

205205
ret = of_k3_udma_glue_parse_chn_common(common, thread_id, tx_chn);
206-
207-
out_put_spec:
208-
of_node_put(udmax_np);
209206
return ret;
210207
}
211208

drivers/dma/xilinx/xdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,11 +885,11 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
885885
u32 st;
886886
bool repeat_tx;
887887

888+
spin_lock(&xchan->vchan.lock);
889+
888890
if (xchan->stop_requested)
889891
complete(&xchan->last_interrupt);
890892

891-
spin_lock(&xchan->vchan.lock);
892-
893893
/* get submitted request */
894894
vd = vchan_next_desc(&xchan->vchan);
895895
if (!vd)

0 commit comments

Comments
 (0)