Author: neel
Date: Sat Apr 13 05:11:21 2013
New Revision: 249435
URL: http://svnweb.freebsd.org/changeset/base/249435

Log:
  Use the MAKEDEV_CHECKNAME flag to check for an invalid device name and return
  an error instead of panicking.
  
  Obtained from:        NetApp

Modified:
  head/sys/amd64/vmm/vmm_dev.c

Modified: head/sys/amd64/vmm/vmm_dev.c
==============================================================================
--- head/sys/amd64/vmm/vmm_dev.c        Sat Apr 13 02:15:59 2013        
(r249434)
+++ head/sys/amd64/vmm/vmm_dev.c        Sat Apr 13 05:11:21 2013        
(r249435)
@@ -497,8 +497,12 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS)
                return (EEXIST);
        }
 
-       sc->cdev = make_dev(&vmmdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
-                           "vmm/%s", buf);
+       error = make_dev_p(MAKEDEV_CHECKNAME, &sc->cdev, &vmmdevsw, NULL,
+                          UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf);
+       if (error != 0) {
+               vmmdev_destroy(sc, TRUE);
+               return (error);
+       }
        sc->cdev->si_drv1 = sc;
 
        return (0);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to