]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: avoid applying capsicum capabilities to file that was not opened
authorrobak <robak@FreeBSD.org>
Sat, 11 Nov 2017 22:50:14 +0000 (22:50 +0000)
committerrobak <robak@FreeBSD.org>
Sat, 11 Nov 2017 22:50:14 +0000 (22:50 +0000)
commit746101149f8fa4919f94a68d6ddb10be0df4a363
treeb77b5876f9dfeb37df76f2ae8692280c67303d66
parent1e871cdd8645372d2a01dc79459e1f286170cfa9
bhyve: avoid applying capsicum capabilities to file that was not opened

When using -l option targeting file that can't be opened (ie. nmdm module
is not loaded and /dev/nmdm* is specified) bhyve tries to apply capsicum
capabilities to a file that was not opened.

Enclose that code in an if statement and only run it on correctly opened
descriptor also providing meaningful message in case of an error.

Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by: grehan, emaste
Sponsoied by: Mysterious Code Ltd.
Differential Revision: D12985
usr.sbin/bhyve/uart_emul.c