Author: grehan
Date: Mon Feb 23 22:31:39 2015
New Revision: 279220
URL: https://svnweb.freebsd.org/changeset/base/279220

Log:
  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.

Modified:
  head/usr.sbin/bhyve/pci_ahci.c

Modified: head/usr.sbin/bhyve/pci_ahci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_ahci.c      Mon Feb 23 21:59:30 2015        
(r279219)
+++ head/usr.sbin/bhyve/pci_ahci.c      Mon Feb 23 22:31:39 2015        
(r279220)
@@ -1968,7 +1968,8 @@ pci_ahci_init(struct vmctx *ctx, struct 
 
 open_fail:
        if (ret) {
-               blockif_close(sc->port[0].bctx);
+               if (sc->port[0].bctx != NULL)
+                       blockif_close(sc->port[0].bctx);
                free(sc);
        }
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to