Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mcgill-vision.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!lll-crg!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: 4.2bsd `mount' syscall bug (and fix) Message-ID: <333@mcgill-vision.UUCP> Date: Wed, 27-Nov-85 04:30:01 EST Article-I.D.: mcgill-v.333 Posted: Wed Nov 27 04:30:01 1985 Date-Received: Fri, 29-Nov-85 21:43:39 EST Organization: McGill University, Montreal Lines: 72 Xref: watmath net.bugs.4bsd:1859 net.unix-wizards:15889 The 4.2bsd mount() syscall appears to have a bug in it. Symptom: After certain attempts to perform an invalid mount, the system will hang and must be forcibly crashed and rebooted. Repeat-by: mkdir foo /etc/mount /dev/null foo ("Block device required" error message) Now the next attempt to access /dev/null will hang the process attempting to do so. For something like /dev/null, this will hang most of the system. Problem: In sys/ufs_mount.c, when getmdev() detects certain errors, it will return without unlocking the inode in question. Fix: Apply the following context diffs to sys/ufs_mount.c. Remember, line number figures are for comparison only. Your line numbers may vary depending on your coding style and degree of kernel hacking. Highway mileage will likely be lower. *** ufs_mount.c Wed Nov 27 04:21:53 1985 --- ufs_mount.c= Wed Nov 6 01:20:57 1985 *************** *** 266,272 if (ip == NULL) return (u.u_error); if ((ip->i_mode&IFMT) != IFBLK) ! { iput(ip); return(ENOTBLK); } dev = (dev_t)ip->i_rdev; if (major(dev) >= nblkdev) { iput(ip); return(ENXIO); } --- 266,272 ----- if (ip == NULL) return (u.u_error); if ((ip->i_mode&IFMT) != IFBLK) ! return (ENOTBLK); dev = (dev_t)ip->i_rdev; if (major(dev) >= nblkdev) return (ENXIO); *************** *** 269,275 { iput(ip); return(ENOTBLK); } dev = (dev_t)ip->i_rdev; if (major(dev) >= nblkdev) ! { iput(ip); return(ENXIO); } iput(ip); *pdev = dev; return (0); --- 269,275 ----- return (ENOTBLK); dev = (dev_t)ip->i_rdev; if (major(dev) >= nblkdev) ! return (ENXIO); iput(ip); *pdev = dev; return (0); -- der Mouse USA: {ihnp4,decvax,akgua,etc}!utcsri!mcgill-vision!mouse philabs!micomvax!musocs!mcgill-vision!mouse Europe: mcvax!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse Hacker: One responsible for destroying / Wizard: One responsible for recovering it afterward