Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 2013 05:11:21 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r249435 - head/sys/amd64/vmm
Message-ID:  <201304130511.r3D5BLjp003362@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304130511.r3D5BLjp003362>