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, Dec 10, 7:00 AM
Unknown Object (File)
Thu, Dec 5, 2:54 AM
Unknown Object (File)
Sat, Nov 30, 7:53 AM
Unknown Object (File)
Wed, Nov 27, 1:53 PM
Unknown Object (File)
Nov 20 2024, 12:07 AM
Unknown Object (File)
Oct 17 2024, 8:38 AM
Unknown Object (File)
Oct 3 2024, 10:03 AM
Unknown Object (File)
Oct 2 2024, 4:35 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

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.