Page MenuHomeFreeBSD

fix resource double deallocation

Authored by br on Mon, Oct 11, 6:50 PM.



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

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

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

context added

jrtc27 added inline comments.

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.Tue, Oct 12, 7:29 PM
This revision was automatically updated to reflect the committed changes.