Skip to content

Commit 6a97cee

Browse files
diandersgregkh
authored andcommitted
Revert "usb: dwc3: dwc3-qcom: Enable tx-fifo-resize property by default"
This reverts commit cefdd52. On sc7180-trogdor class devices with 'fw_devlink=permissive' and KASAN enabled, you'll see a Use-After-Free reported at bootup. The root of the problem is that dwc3_qcom_of_register_core() is adding a devm-allocated "tx-fifo-resize" property to its device tree node using of_add_property(). The issue is that of_add_property() makes a _permanent_ addition to the device tree that lasts until reboot. That means allocating memory for the property using "devm" managed memory is a terrible idea since that memory will be freed upon probe deferral or device unbinding. Let's revert the patch since the system is still functional without it. The fact that of_add_property() makes a permanent change is extra fodder for those folks who were aruging that the device tree isn't really the right way to pass information between parts of the driver. It is an exercise left to the reader to submit a patch re-adding the new feature in a way that makes everyone happier. Fixes: cefdd52 ("usb: dwc3: dwc3-qcom: Enable tx-fifo-resize property by default") Cc: stable <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/20211207094327.1.Ie3cde3443039342e2963262a4c3ac36dc2c08b30@changeid Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0fcfb00 commit 6a97cee

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev)
649649
struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
650650
struct device_node *np = pdev->dev.of_node, *dwc3_np;
651651
struct device *dev = &pdev->dev;
652-
struct property *prop;
653652
int ret;
654653

655654
dwc3_np = of_get_compatible_child(np, "snps,dwc3");
@@ -658,20 +657,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev)
658657
return -ENODEV;
659658
}
660659

661-
prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL);
662-
if (!prop) {
663-
ret = -ENOMEM;
664-
dev_err(dev, "unable to allocate memory for property\n");
665-
goto node_put;
666-
}
667-
668-
prop->name = "tx-fifo-resize";
669-
ret = of_add_property(dwc3_np, prop);
670-
if (ret) {
671-
dev_err(dev, "unable to add property\n");
672-
goto node_put;
673-
}
674-
675660
ret = of_platform_populate(np, NULL, NULL, dev);
676661
if (ret) {
677662
dev_err(dev, "failed to register dwc3 core - %d\n", ret);

0 commit comments

Comments
 (0)