Page MenuHomeFreeBSD

fix resource double deallocation
ClosedPublic

Authored by br on Oct 11 2021, 6:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 22, 8:25 PM
Unknown Object (File)
Sat, Apr 19, 2:40 PM
Unknown Object (File)
Sat, Apr 19, 1:37 PM
Unknown Object (File)
Apr 1 2025, 3:18 AM
Unknown Object (File)
Mar 15 2025, 5:22 AM
Unknown Object (File)
Mar 11 2025, 10:44 PM
Unknown Object (File)
Feb 25 2025, 8:09 PM
Unknown Object (File)
Feb 22 2025, 1:11 PM
Subscribers

Details

Summary

Since rman freed the resource, it is no longer available so don't call to bus_generic_release_resource()

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.Oct 11 2021, 6:50 PM
br updated this revision to Diff 96691.
br created this revision.

context added

jrtc27 added inline comments.
sys/dev/pci/pci_host_generic.c
318–319

The alloc_resource path instead does:

	if (rm == NULL)
		return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
		    type, rid, start, end, count, flags));

perhaps the same should be done here, i.e. inverting the condition?

The current code is also a bit inconsistent between using BUS_FOO and bus_generic_foo, though they're equivalent (unless there is no parent, in which case bus_generic_foo will gracefully return EINVAL rather than faulting on a NULL dereference).

I like previous version, because it is easier to read the diff

This revision is now accepted and ready to land.Oct 12 2021, 7:29 PM
This revision was automatically updated to reflect the committed changes.