Page MenuHomeFreeBSD

bhyve(8) pci_xhci.c elliminate possible double free of uopt
ClosedPublic

Authored by rgrimes on Feb 14 2019, 8:00 PM.
Tags
None
Referenced Files
F106130434: D19202.diff
Wed, Dec 25, 9:59 PM
Unknown Object (File)
Mon, Dec 16, 11:24 PM
Unknown Object (File)
Wed, Dec 11, 11:34 AM
Unknown Object (File)
Nov 19 2024, 3:22 AM
Unknown Object (File)
Nov 10 2024, 8:03 PM
Unknown Object (File)
Oct 25 2024, 1:30 AM
Unknown Object (File)
Oct 23 2024, 11:33 AM
Unknown Object (File)
Oct 19 2024, 9:26 AM
Subscribers

Details

Summary

In r340044 an attempt to quiet coverity warning cid 1357336 was incorrectly implemented leading to a possible double free.

It is possible for both the conditional free, and the unconditional free added in r340044 to be done, fix that by initializing uopt to NULL, removing the conditional free, and only using the unconditional free at the end.

Brought to my attention by Patrick Mooney of Joyent/illumos

Test Plan

Visial code inspection, and compile tested.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This is the fix we're applying to SmartOS bhyve, after syncing from upstream.

jhb added inline comments.
usr.sbin/bhyve/pci_xhci.c
2630

style nit would be to initialize the value on a separate line here rather than in the declaration.

This revision is now accepted and ready to land.Feb 14 2019, 8:15 PM

Move initialization of uopt to after declares addressing jhb style(9) issue

This revision now requires review to proceed.Feb 14 2019, 8:23 PM

Address jhb style 9 issues

usr.sbin/bhyve/pci_xhci.c
2630

You are correct, I applied my minimal lines of diff and no style correction. I should of just added a line after the declares to initialize it, as that achives the same result.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2019, 4:48 PM
This revision was automatically updated to reflect the committed changes.