public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]Fix bug:rmdir could remove current working directory
@ 2001-10-11  0:32 Mingming cao
  2001-10-10 21:45 ` Alexander Viro
  2001-10-10 22:21 ` Ricky Beam
  0 siblings, 2 replies; 8+ messages in thread
From: Mingming cao @ 2001-10-11  0:32 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox, viro; +Cc: linux-kernel

Hi Linus, Alan and Al,

I found that rmdir(2) could remove current working directory
successfully.  This happens when the given pathname points to current
working directory, not ".", but something else. For example, the current
working directory's absolute pathname.  I read the man page of
rmdir(2).  It says in this case EBUSY error should be returned.  I
suspected this is a bug and added a check in vfs_rmdir(). The following
patch is against 2.4.10 and has been verified.  Please comment and
apply.

-- 
Mingming Cao

--- linux-2.4.10/fs/namei.c	Tue Sep 18 11:01:47 2001
+++ /home/ming/linux-tk/fs/namei.c	Tue Oct  9 11:58:50 2001
@@ -1362,6 +1362,8 @@
 		error = -ENOENT;
 	else if (d_mountpoint(dentry))
 		error = -EBUSY;
+	else if (dentry == current->fs->pwd)
+		error = -EBUSY;
 	else {
 		lock_kernel();
 		error = dir->i_op->rmdir(dir, dentry);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-10-11  0:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-11  0:32 [PATCH]Fix bug:rmdir could remove current working directory Mingming cao
2001-10-10 21:45 ` Alexander Viro
2001-10-11  1:03   ` Mingming cao
2001-10-10 22:09     ` Alexander Viro
2001-10-10 23:17     ` Linus Torvalds
     [not found]     ` <200110102317.f9ANHjN03120@penguin.transmeta.com>
2001-10-11  3:02       ` Mingming cao
2001-10-10 22:21 ` Ricky Beam
2001-10-10 23:36   ` John Levon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox