Skip to contentSkip to conversation

patch for open file handles with initrd in 2.4.20

PATCH Russell Coker 1 participant 1 message Jan 22, 2003 VFS

lore
Share & tools
lore
#0 lore raw

The following patch was back-ported from 2.5.x by Stephen Smalley to fix a problem where the file handle of the root of the initrd is inherited by init and other processes.

The bug was discovered when running SE Linux on 2.4.20 systems with a policy that denied such inheriting of file handles and logged the operations it denied.

This patch has been well tested, please include it in 2.4.21.

init/do_mounts.c +2 -0
@@ -812,6 +812,8 @@
 	/* switch root and cwd back to / of rootfs */
 	sys_fchdir(root_fd);
 	sys_chroot(".");
+	close(old_fd);
+	close(root_fd);
 	sys_umount("/old/dev", 0);
 
 	if (real_root_dev == ram0) {