From fe417ad0efdf365d5438ae46904118fa27ae38b8 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Fri, 19 Jun 2020 11:41:35 +0000 Subject: 12853 bhyve manifests should include BSD license Reviewed by: Patrick Mooney Approved by: Dan McDonald --- usr/src/lib/libvmmapi/THIRDPARTYLICENSE | 26 +++++++++++++++++++++++++ usr/src/lib/libvmmapi/THIRDPARTYLICENSE.descrip | 1 + 2 files changed, 27 insertions(+) create mode 100644 usr/src/lib/libvmmapi/THIRDPARTYLICENSE create mode 100644 usr/src/lib/libvmmapi/THIRDPARTYLICENSE.descrip (limited to 'usr/src/lib') diff --git a/usr/src/lib/libvmmapi/THIRDPARTYLICENSE b/usr/src/lib/libvmmapi/THIRDPARTYLICENSE new file mode 100644 index 0000000000..66b39dc950 --- /dev/null +++ b/usr/src/lib/libvmmapi/THIRDPARTYLICENSE @@ -0,0 +1,26 @@ + +SPDX-License-Identifier: BSD-2-Clause-FreeBSD + +Copyright (c) 1992-2020 The FreeBSD Project. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + diff --git a/usr/src/lib/libvmmapi/THIRDPARTYLICENSE.descrip b/usr/src/lib/libvmmapi/THIRDPARTYLICENSE.descrip new file mode 100644 index 0000000000..77026fc8a3 --- /dev/null +++ b/usr/src/lib/libvmmapi/THIRDPARTYLICENSE.descrip @@ -0,0 +1 @@ +Bhyve hypervisor -- cgit v1.2.3 From be235d17490f6a5ad01c6a5319530fce66d88389 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Wed, 5 Aug 2020 22:20:29 -0700 Subject: 12801 libdiskmgt leaks PROM device information handles like a sieve Reviewed by: Garrett D'Amore Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Richard Lowe --- usr/src/lib/libdiskmgt/common/findevs.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'usr/src/lib') diff --git a/usr/src/lib/libdiskmgt/common/findevs.c b/usr/src/lib/libdiskmgt/common/findevs.c index 8114f31352..440d8585db 100644 --- a/usr/src/lib/libdiskmgt/common/findevs.c +++ b/usr/src/lib/libdiskmgt/common/findevs.c @@ -27,6 +27,7 @@ /* * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. + * Copyright 2020 Oxide Computer Company */ #include @@ -149,8 +150,23 @@ findevs(struct search_args *args) args->controller_listp = NULL; args->disk_listp = NULL; + args->ph = DI_PROM_HANDLE_NIL; + args->handle = DI_LINK_NIL; args->dev_walk_status = 0; - args->handle = di_devlink_init(NULL, 0); + + /* + * Create device information library handles, which must be destroyed + * before we return. + */ + if ((args->ph = di_prom_init()) == DI_PROM_HANDLE_NIL || + (args->handle = di_devlink_init(NULL, 0)) == DI_LINK_NIL) { + /* + * We could not open all of the handles we need, so clean up + * and report failure to the caller. + */ + args->dev_walk_status = errno; + goto cleanup; + } /* * Have to make several passes at this with the new devfs caching. @@ -158,7 +174,6 @@ findevs(struct search_args *args) * devices. */ di_root = di_init("/", DINFOCACHE); - args->ph = di_prom_init(); (void) di_walk_minor(di_root, NULL, 0, args, add_devs); di_fini(di_root); @@ -166,9 +181,16 @@ findevs(struct search_args *args) (void) di_walk_minor(di_root, NULL, 0, args, add_devs); di_fini(di_root); - (void) di_devlink_fini(&(args->handle)); - clean_paths(args); + +cleanup: + if (args->ph != DI_PROM_HANDLE_NIL) { + di_prom_fini(args->ph); + args->ph = DI_PROM_HANDLE_NIL; + } + if (args->handle != DI_LINK_NIL) { + (void) di_devlink_fini(&(args->handle)); + } } /* -- cgit v1.2.3