mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
dmaengine fixes for v6.17
Couple of driver fixes for:
- Intel idxd fixes for idxd_free() handling, refcount underflow on
module unload, double free in idxd_setup_wqs().
- Qualcomm bam dma missing properties and handing for channels with ees
- dw device reference leak in rzn1_dmamux_route_allocate()
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmjG9/8ACgkQfBQHDyUj
g0emdBAAkBy+Nuft8OcjhfHGFP6aMpVccNoNJUqPDc49yhVPTlu0i360i0wYIwwf
K06NRBSvAQf611ghyPkKPhlLB/+Dcos2KSBQBsdMi3RTreym2K+4nEw/5l+fznTB
VtJ8xSDKILPMy1HVPC9y7zo6ak7DjtyFcZkVN1TH+T+EIfbp5vVV81vHGNFcRIUB
gsRu4mpz/WEkI52FGjnbqS1/SePspbbXt8CC+U1Ypx7aHr6fLyOm5mS0xPbvSM/c
xeuBXqcQd/VPdGa6RJcuV4td3sKXEIWdz7Q1rI/CDCwVvg/AathePsvemE6aCn2t
9erMbXGHmRiGqFvH9+y3lwfpnctALgA8bAOuK1PrrCrjlbmoq7bVNzxWNnNi4Wtu
sTNyebbNtLgPV9IGVQX8Y3lk4uK9H3s0KTVz5yD2Uki2KbK1yJJstIa87167omDx
LcbxyTb2nRKKjDn+JZ5MFXqt8stJ8hv4jPl7UkY6dfmjAobpnobsgn33J+a++/Ta
ZjCIk+sb2QVcl8UNoy1QS6dKFPtiVsGQ6prY2GuotU4289LIioXP1/D/ACqEilQs
+nZqg39yj5VPLEZWC96ta6/16RbXbAmdyrGeadmefd4MTIWa5ZmVPwDJgLQM9SWX
+w3icOPDx4h56Qeouy7PfBdeHL9775JM7MUGstzCYVEYDnrwroI=
=ei5l
-----END PGP SIGNATURE-----
Merge tag 'dmaengine-fix-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine
Pull dmaengine fixes from Vinod Koul:
- Intel idxd fixes for idxd_free() handling, refcount underflow on
module unload, double free in idxd_setup_wqs()
- Qualcomm bam dma missing properties and handing for channels with ees
- dw device reference leak in rzn1_dmamux_route_allocate()
* tag 'dmaengine-fix-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
dmaengine: dw: dmamux: Fix device reference leak in rzn1_dmamux_route_allocate
dmaengine: ti: edma: Fix memory allocation size for queue_priority_map
dmaengine: idxd: Fix double free in idxd_setup_wqs()
dmaengine: idxd: Fix refcount underflow on module unload
dmaengine: idxd: Remove improper idxd_free
dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
dt-bindings: dma: qcom: bam-dma: Add missing required properties
This commit is contained in:
commit
0676181a87
|
|
@ -92,8 +92,12 @@ required:
|
|||
anyOf:
|
||||
- required:
|
||||
- qcom,powered-remotely
|
||||
- num-channels
|
||||
- qcom,num-ees
|
||||
- required:
|
||||
- qcom,controlled-remotely
|
||||
- num-channels
|
||||
- qcom,num-ees
|
||||
- required:
|
||||
- clocks
|
||||
- clock-names
|
||||
|
|
|
|||
|
|
@ -48,12 +48,16 @@ static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
|
|||
u32 mask;
|
||||
int ret;
|
||||
|
||||
if (dma_spec->args_count != RNZ1_DMAMUX_NCELLS)
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (dma_spec->args_count != RNZ1_DMAMUX_NCELLS) {
|
||||
ret = -EINVAL;
|
||||
goto put_device;
|
||||
}
|
||||
|
||||
map = kzalloc(sizeof(*map), GFP_KERNEL);
|
||||
if (!map)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
if (!map) {
|
||||
ret = -ENOMEM;
|
||||
goto put_device;
|
||||
}
|
||||
|
||||
chan = dma_spec->args[0];
|
||||
map->req_idx = dma_spec->args[4];
|
||||
|
|
@ -94,12 +98,15 @@ static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
|
|||
if (ret)
|
||||
goto clear_bitmap;
|
||||
|
||||
put_device(&pdev->dev);
|
||||
return map;
|
||||
|
||||
clear_bitmap:
|
||||
clear_bit(map->req_idx, dmamux->used_chans);
|
||||
free_map:
|
||||
kfree(map);
|
||||
put_device:
|
||||
put_device(&pdev->dev);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,27 +189,30 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
|
|||
idxd->wq_enable_map = bitmap_zalloc_node(idxd->max_wqs, GFP_KERNEL, dev_to_node(dev));
|
||||
if (!idxd->wq_enable_map) {
|
||||
rc = -ENOMEM;
|
||||
goto err_bitmap;
|
||||
goto err_free_wqs;
|
||||
}
|
||||
|
||||
for (i = 0; i < idxd->max_wqs; i++) {
|
||||
wq = kzalloc_node(sizeof(*wq), GFP_KERNEL, dev_to_node(dev));
|
||||
if (!wq) {
|
||||
rc = -ENOMEM;
|
||||
goto err;
|
||||
goto err_unwind;
|
||||
}
|
||||
|
||||
idxd_dev_set_type(&wq->idxd_dev, IDXD_DEV_WQ);
|
||||
conf_dev = wq_confdev(wq);
|
||||
wq->id = i;
|
||||
wq->idxd = idxd;
|
||||
device_initialize(wq_confdev(wq));
|
||||
device_initialize(conf_dev);
|
||||
conf_dev->parent = idxd_confdev(idxd);
|
||||
conf_dev->bus = &dsa_bus_type;
|
||||
conf_dev->type = &idxd_wq_device_type;
|
||||
rc = dev_set_name(conf_dev, "wq%d.%d", idxd->id, wq->id);
|
||||
if (rc < 0)
|
||||
goto err;
|
||||
if (rc < 0) {
|
||||
put_device(conf_dev);
|
||||
kfree(wq);
|
||||
goto err_unwind;
|
||||
}
|
||||
|
||||
mutex_init(&wq->wq_lock);
|
||||
init_waitqueue_head(&wq->err_queue);
|
||||
|
|
@ -220,15 +223,20 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
|
|||
wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
|
||||
wq->wqcfg = kzalloc_node(idxd->wqcfg_size, GFP_KERNEL, dev_to_node(dev));
|
||||
if (!wq->wqcfg) {
|
||||
put_device(conf_dev);
|
||||
kfree(wq);
|
||||
rc = -ENOMEM;
|
||||
goto err;
|
||||
goto err_unwind;
|
||||
}
|
||||
|
||||
if (idxd->hw.wq_cap.op_config) {
|
||||
wq->opcap_bmap = bitmap_zalloc(IDXD_MAX_OPCAP_BITS, GFP_KERNEL);
|
||||
if (!wq->opcap_bmap) {
|
||||
kfree(wq->wqcfg);
|
||||
put_device(conf_dev);
|
||||
kfree(wq);
|
||||
rc = -ENOMEM;
|
||||
goto err_opcap_bmap;
|
||||
goto err_unwind;
|
||||
}
|
||||
bitmap_copy(wq->opcap_bmap, idxd->opcap_bmap, IDXD_MAX_OPCAP_BITS);
|
||||
}
|
||||
|
|
@ -239,13 +247,7 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
|
|||
|
||||
return 0;
|
||||
|
||||
err_opcap_bmap:
|
||||
kfree(wq->wqcfg);
|
||||
|
||||
err:
|
||||
put_device(conf_dev);
|
||||
kfree(wq);
|
||||
|
||||
err_unwind:
|
||||
while (--i >= 0) {
|
||||
wq = idxd->wqs[i];
|
||||
if (idxd->hw.wq_cap.op_config)
|
||||
|
|
@ -254,11 +256,10 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
|
|||
conf_dev = wq_confdev(wq);
|
||||
put_device(conf_dev);
|
||||
kfree(wq);
|
||||
|
||||
}
|
||||
bitmap_free(idxd->wq_enable_map);
|
||||
|
||||
err_bitmap:
|
||||
err_free_wqs:
|
||||
kfree(idxd->wqs);
|
||||
|
||||
return rc;
|
||||
|
|
@ -1291,10 +1292,12 @@ static void idxd_remove(struct pci_dev *pdev)
|
|||
device_unregister(idxd_confdev(idxd));
|
||||
idxd_shutdown(pdev);
|
||||
idxd_device_remove_debugfs(idxd);
|
||||
idxd_cleanup(idxd);
|
||||
perfmon_pmu_remove(idxd);
|
||||
idxd_cleanup_interrupts(idxd);
|
||||
if (device_pasid_enabled(idxd))
|
||||
idxd_disable_system_pasid(idxd);
|
||||
pci_iounmap(pdev, idxd->reg_base);
|
||||
put_device(idxd_confdev(idxd));
|
||||
idxd_free(idxd);
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1283,13 +1283,17 @@ static int bam_dma_probe(struct platform_device *pdev)
|
|||
if (!bdev->bamclk) {
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
|
||||
&bdev->num_channels);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
dev_err(bdev->dev, "num-channels unspecified in dt\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "qcom,num-ees",
|
||||
&bdev->num_ees);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
dev_err(bdev->dev, "num-ees unspecified in dt\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(bdev->bamclk);
|
||||
|
|
|
|||
|
|
@ -2064,8 +2064,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
|
|||
* priority. So Q0 is the highest priority queue and the last queue has
|
||||
* the lowest priority.
|
||||
*/
|
||||
queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1, sizeof(s8),
|
||||
GFP_KERNEL);
|
||||
queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1,
|
||||
sizeof(*queue_priority_map), GFP_KERNEL);
|
||||
if (!queue_priority_map)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user