Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mandrill!gatech!udel!mmdf
From: Bruno_Kieba.SBDERX@xerox.com
Newsgroups: comp.os.minix
Subject: Bug in source file "link.c"
Message-ID: <3089@louie.udel.EDU>
Date: 22 Jun 88 21:27:49 GMT
Sender: mmdf@udel.EDU
Lines: 24

When I  implemented the capability-based protection in Minix 1.1, I came across
a little bug (or is there?) in the original file system source file "link.c".  I
corrected it anyhow in my source.  If Dr. Andy Tanenbaum reads this mail note
then this bug could be corrected before the release of 1.3 (please tell me if I
am wrong!).

In the source file "link.c" (File System, Minix 1.1),  if the final directory of
"name2" does not exist (line #11304) then the i-node of "name", previously read
into the i-node table (line #11287), is never "put-inoded" and thus wastes
resources (ie: i-node table entries and file descriptor entries in process table
if many unsuccessful linking to "name2" happen).
If Minix was locking files (UNIX does), then this could entail a deadlock!

The code I guess should be like:

11304		if  (fetch-name(name2, name2-length, M1) != OK)	{
11304.1 ----->	put-inode(rip);      /* put "name"'s i-node first  */
11304.2		return(err-code); /* before returning an error */
11304.3	}
11305		.....(same).....

Am I right?

Bruno