[LTP] tpci: Unbind/rebind driver in test_assign_resources()
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Fri Apr 17 11:22:58 CEST 2026
Hi Hongtao,
On Fri, 17 Apr 2026 10:29:49 +0800, Hongtao Zhang wrote:
> tpci: Unbind/rebind driver in test_assign_resources()
> + if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
> + if (dev->dev.driver)
> + device_release_driver(&dev->dev);
> + }
> +
> pci_release_resource(dev, i);
> ret = pci_assign_resource(dev, i);
> +
> + if (ret == 0) {
> + if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
> + int attach_ret;
> +
> + attach_ret = device_attach(&dev->dev);
> + if (attach_ret < 0)
> + prk_info("device_attach failed for endpoint, ret: %d", attach_ret);
> + }
> + }
Properly unbinding before BAR reassignment and rebinding afterward
prevents the dangling resource->name pointer UAF in /proc/iomem.
Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>
---
Note:
Our agent completed the review of the patch.
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list