From: Mingming cao <cmm@us.ibm.com>
To: Linus Torvalds <torvalds@transmeta.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
viro@math.psu.edu
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH]Fix bug:rmdir could remove current working directory
Date: Wed, 10 Oct 2001 14:32:45 -1000 [thread overview]
Message-ID: <3BC4E8AD.72F175E3@us.ibm.com> (raw)
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);
next reply other threads:[~2001-10-10 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-11 0:32 Mingming cao [this message]
2001-10-10 21:45 ` [PATCH]Fix bug:rmdir could remove current working directory 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BC4E8AD.72F175E3@us.ibm.com \
--to=cmm@us.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=viro@math.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox