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
Unknown Object (File)
Jan 28 2024, 4:09 AM
Unknown Object (File)
Jan 14 2024, 4:11 AM
Unknown Object (File)
Jan 10 2024, 12:27 AM
Unknown Object (File)
Dec 23 2023, 1:47 PM
Unknown Object (File)
Dec 12 2023, 9:49 PM
Unknown Object (File)
Sep 14 2023, 9:33 AM
Unknown Object (File)
Sep 6 2023, 7:38 AM
Unknown Object (File)
Jul 24 2023, 10:20 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
2629 ↗(On Diff #53936)

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
2629 ↗(On Diff #53936)

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.