From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 13:33:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 420E729B; Sat, 22 Dec 2012 13:33:29 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0D79A8FC0A; Sat, 22 Dec 2012 13:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBMDXS73085315; Sat, 22 Dec 2012 13:33:28 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBMDXSrj085313; Sat, 22 Dec 2012 13:33:28 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201212221333.qBMDXSrj085313@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 22 Dec 2012 13:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244584 - in head: share/man/man9 sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 13:33:29 -0000 Author: jh Date: Sat Dec 22 13:33:28 2012 New Revision: 244584 URL: http://svnweb.freebsd.org/changeset/base/244584 Log: Reject spaces and double quotation marks in device names. devctl(4) and devd(8) can't handle names with such characters properly. PR: bin/144736, kern/161912 Discussed with: imp, kib, pjd Modified: head/share/man/man9/make_dev.9 head/sys/kern/kern_conf.c Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Sat Dec 22 13:02:03 2012 (r244583) +++ head/share/man/man9/make_dev.9 Sat Dec 22 13:33:28 2012 (r244584) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2011 +.Dd Dec 22, 2012 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -364,6 +364,10 @@ or .Qq .. path component or ends with .Ql / . +.It Bq Er EINVAL +The +.Dv MAKEDEV_CHECKNAME +flag was specified and the provided device name contains invalid characters. .It Bq Er EEXIST The .Dv MAKEDEV_CHECKNAME Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sat Dec 22 13:02:03 2012 (r244583) +++ head/sys/kern/kern_conf.c Sat Dec 22 13:33:28 2012 (r244584) @@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const cha ; for (to = dev->si_name; *from != '\0'; from++, to++) { + /* + * Spaces and double quotation marks cause + * problems for the devctl(4) protocol. + * Reject names containing those characters. + */ + if (isspace(*from) || *from == '"') + return (EINVAL); /* Treat multiple sequential slashes as single. */ while (from[0] == '/' && from[1] == '/') from++;