Ensure that block and character devices as well as fifo's and sockets

all have zero length. A non-zero length panic's the kernel when one
of these is deleted.

PR:		19426
Submitted by:	Ian Dowse <iedowse@maths.tcd.ie>
Reviewed by:	dwmalone@FreeBSD.org
This commit is contained in:
Kirk McKusick 2000-07-12 06:19:22 +00:00
parent 07632cbf66
commit 7932349eff
3 changed files with 18 additions and 0 deletions

View File

@ -209,6 +209,12 @@ checkinode(inumber, idesc)
dp->di_mode = IFREG|0600; dp->di_mode = IFREG|0600;
inodirty(); inodirty();
} }
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
mode == IFSOCK) && dp->di_size != 0) {
if (debug)
printf("bad special-file size %qu:", dp->di_size);
goto unknown;
}
ndb = howmany(dp->di_size, sblock.fs_bsize); ndb = howmany(dp->di_size, sblock.fs_bsize);
if (ndb < 0) { if (ndb < 0) {
if (debug) if (debug)

View File

@ -209,6 +209,12 @@ checkinode(inumber, idesc)
dp->di_mode = IFREG|0600; dp->di_mode = IFREG|0600;
inodirty(); inodirty();
} }
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
mode == IFSOCK) && dp->di_size != 0) {
if (debug)
printf("bad special-file size %qu:", dp->di_size);
goto unknown;
}
ndb = howmany(dp->di_size, sblock.fs_bsize); ndb = howmany(dp->di_size, sblock.fs_bsize);
if (ndb < 0) { if (ndb < 0) {
if (debug) if (debug)

View File

@ -209,6 +209,12 @@ checkinode(inumber, idesc)
dp->di_mode = IFREG|0600; dp->di_mode = IFREG|0600;
inodirty(); inodirty();
} }
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
mode == IFSOCK) && dp->di_size != 0) {
if (debug)
printf("bad special-file size %qu:", dp->di_size);
goto unknown;
}
ndb = howmany(dp->di_size, sblock.fs_bsize); ndb = howmany(dp->di_size, sblock.fs_bsize);
if (ndb < 0) { if (ndb < 0) {
if (debug) if (debug)