summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2001-02-15 22:26:21 +0000
committertegge <tegge@FreeBSD.org>2001-02-15 22:26:21 +0000
commitba2c37c2e3379a6cc74bada679320b730244fd21 (patch)
treeb6a587811bcb63c05cbbd8e2ae97e6543b8fe871 /sbin/fsck_ffs
parentaf67e8b5e143511f03edb5afb24c8a755bdfc44f (diff)
downloadFreeBSD-src-ba2c37c2e3379a6cc74bada679320b730244fd21.zip
FreeBSD-src-ba2c37c2e3379a6cc74bada679320b730244fd21.tar.gz
Don't allow special devices of type NODEV (NOUDEV as seen from kernel).
They can't be created via mknod and the kernel crashes if it encounters such an inode. Approved by: mckusick
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r--sbin/fsck_ffs/pass1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index 2772ec1..3d09bd0 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -228,6 +228,11 @@ checkinode(inumber, idesc)
printf("bad special-file size %qu:", dp->di_size);
goto unknown;
}
+ if ((mode == IFBLK || mode == IFCHR) && (dev_t)dp->di_rdev == NODEV) {
+ if (debug)
+ printf("bad special-file rdev NODEV:");
+ goto unknown;
+ }
ndb = howmany(dp->di_size, sblock.fs_bsize);
if (ndb < 0) {
if (debug)
OpenPOWER on IntegriCloud