diff options
author | jh <jh@FreeBSD.org> | 2012-12-22 13:33:28 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2012-12-22 13:33:28 +0000 |
commit | de8a1071d5920bcdea674f08250851affe15dc4f (patch) | |
tree | ca421b04ae201d70a9ecb7d6d2dc686c5c9b74b5 | |
parent | d2861e92958113d0e11a6d2708af91daa4ed0125 (diff) | |
download | FreeBSD-src-de8a1071d5920bcdea674f08250851affe15dc4f.zip FreeBSD-src-de8a1071d5920bcdea674f08250851affe15dc4f.tar.gz |
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
-rw-r--r-- | share/man/man9/make_dev.9 | 6 | ||||
-rw-r--r-- | sys/kern/kern_conf.c | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9 index 2827235..78345fa 100644 --- a/share/man/man9/make_dev.9 +++ b/share/man/man9/make_dev.9 @@ -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 diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 288fac5..c04d1da 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap) ; 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++; |