Repository navigation
xen-pciback: free a device's config fields before its dev_data - #88
Merged
Merged
Conversation
pcistub_device_release() frees dev_data and clears drvdata before calling xen_pcibk_config_free_dyn_fields() and xen_pcibk_config_free_dev(). Both look the fields up through drvdata, find NULL and return, so every release from pciback leaks the device's config field entries and their data. kmemleak reports them after the device is released. Free the fields first. Fixes: cd9db80 ("xen/pciback: Support pci_reset_function, aka FLR or D3 support.") Signed-off-by: Kavi <kavi@edera.dev>
alexandermerritt
approved these changes
Nov 5, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Releasing a device from pciback leaks its virtual config space fields, about 25 small allocations per device.
pcistub_device_release()freesdev_dataand clears drvdata before callingxen_pcibk_config_free_dyn_fields()andxen_pcibk_config_free_dev(). Both find the fields through drvdata, so they free nothing, and kmemleak reports the fields afterxl pci-assignable-remove.This frees the fields first.
Tested on edera/6.18-lts by passing a device through to a PV zone and releasing it, after which kmemleak no longer reports the fields.
COR-208