Page MenuHomeFreeBSD

fix resource double deallocation
ClosedPublic

Authored by br on Oct 11 2021, 6:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 12 2024, 8:43 AM
Unknown Object (File)
Jan 1 2024, 11:23 AM
Unknown Object (File)
Dec 20 2023, 7:53 AM
Unknown Object (File)
Dec 1 2023, 2:22 PM
Unknown Object (File)
Nov 28 2023, 6:56 PM
Unknown Object (File)
Nov 28 2023, 12:26 PM
Unknown Object (File)
Nov 27 2023, 10:23 PM
Unknown Object (File)
Nov 26 2023, 10:30 AM
Subscribers

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
321

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.