Subject: Re: CVS commit: syssrc/sys/compat/linux/common
To: None <christos@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: current-users
Date: 03/23/2002 19:46:04
In article <20020322145328.3F43DB004@cvs.netbsd.org>
christos@netbsd.org wrote:

> Module Name:	syssrc
> Committed By:	christos
> Date:		Fri Mar 22 14:53:27 UTC 2002
> 
> Modified Files:
> 	syssrc/sys/compat/linux/common: linux_file.c
> 
> Log Message:
> - obey FILE_USE and FILE_UNUSE
> - don't assume that non sockets point to vnodes.

Now navigator-4.79 on my i386 got "panic: f_usecount underflow"
by FILE_UNUSE() in linux_file.c:linux_sys_fcntl().
Is the following patch right?

Index: linux_file.c
===================================================================
RCS file: /cvsroot/syssrc/sys/compat/linux/common/linux_file.c,v
retrieving revision 1.47
diff -u -r1.47 linux_file.c
--- linux_file.c	2002/03/22 14:53:26	1.47
+++ linux_file.c	2002/03/23 10:39:04
@@ -426,6 +426,7 @@
 		switch (fp->f_type) {
 		case DTYPE_SOCKET:
 			cmd = cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN;
+			FILE_UNUSE(fp, p);
 			goto doit;
 
 		case DTYPE_VNODE:
@@ -483,7 +484,6 @@
 	}
 
 doit:
-	FILE_UNUSE(fp, p);
 	SCARG(&fca, fd) = fd;
 	SCARG(&fca, cmd) = cmd;
 	SCARG(&fca, arg) = arg;

---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp