[PATCH] Error in fdfree()

Matthew Dillon dillon at apollo.backplane.com
Sat Jan 17 11:03:21 PST 2004


:I just ported the new FreeBSD fd code to DragonFly.  Their code
:included this fix which looks like it should be applied to dfly
:no matter what's decided about the rest of it.  As soon as I make
:sure it compiles and boots (tomorrow probably) I'll post it to
:kernel@ if others are interested.  But in the meantime this should
:be applied I think.
:
:Fix off-by-one error in fdfree().
:
:Index: sys/kern/kern_descrip.c
:===================================================================
:RCS file: /home/dcvs/src/sys/kern/kern_descrip.c,v
:retrieving revision 1.17
:diff -u -r1.17 kern_descrip.c
:--- sys/kern/kern_descrip.c	21 Oct 2003 01:05:09 -0000	1.17
:+++ sys/kern/kern_descrip.c	17 Jan 2004 17:25:35 -0000
:@@ -1117,7 +1117,7 @@
: 			i = 0;
: 			fpp = fdp->fd_ofiles;
: 			for (i = 0, fpp = fdp->fd_ofiles;
:-			     i < fdp->fd_lastfile;
:+			     i <= fdp->fd_lastfile;
: 			     i++, fpp++) {
: 				if (*fpp == NULL ||
: 				    (*fpp)->f_type != DTYPE_VNODE)
:
:-- 
:Skip
 
    Thew new fd code?  You mean all that bitmap code DES added?  I was
    only half joking about that.  It's a real mess and not well designed,
    and he just fixed a panic in it too (make sure you get that patch
    'Panic with this morning's (~9am EDT, 15 jan 2004) sources.' in
    freebsd-current).

    But when you have the patch set worked up I'll take a look at it.

    In anycase, the fdfree() bug fix looks correct to me.  It would only
    effect advisory locks in certain particular situations but it does
    indeed appear to be a bug.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Submit mailing list