diff options
author | grehan <grehan@FreeBSD.org> | 2015-02-23 22:31:39 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2015-02-23 22:31:39 +0000 |
commit | ceecb9ed389c30d1cd521d0892f6a43c0c08355c (patch) | |
tree | 843df8496c626cb1478abc2f3a6b9d16bb3dc8d2 | |
parent | d57ea329f69e623a48ddd5f9bf3f410e2ce25a3f (diff) | |
download | FreeBSD-src-ceecb9ed389c30d1cd521d0892f6a43c0c08355c.zip FreeBSD-src-ceecb9ed389c30d1cd521d0892f6a43c0c08355c.tar.gz |
Don't close a block context if it couldn't be opened,
for example if the backing file doesn't exist,
avoiding a null deref.
Reviewed by: neel
MFC after: 1 week.
-rw-r--r-- | usr.sbin/bhyve/pci_ahci.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index ab40854..7db7ed5 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -1968,7 +1968,8 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts, int atapi) open_fail: if (ret) { - blockif_close(sc->port[0].bctx); + if (sc->port[0].bctx != NULL) + blockif_close(sc->port[0].bctx); free(sc); } |