From ba2c37c2e3379a6cc74bada679320b730244fd21 Mon Sep 17 00:00:00 2001 From: tegge Date: Thu, 15 Feb 2001 22:26:21 +0000 Subject: 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 --- sbin/fsck_ffs/pass1.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sbin/fsck_ffs/pass1.c') 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) -- cgit v1.1