From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] more VFAT_IOCTL_READDIR_BOTH/_SHORT ioctl fix (1/11)
Date: Tue, 22 Jul 2003 00:50:27 +0900 [thread overview]
Message-ID: <87oeznx4jg.fsf@devron.myhome.or.jp> (raw)
This fixes
- check the ioctl cmd first
- check the directory whether it's an already dead
Please apply.
fs/fat/dir.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
diff -puN fs/fat/dir.c~fat_more-ioctl-fix fs/fat/dir.c
--- linux-2.6.0-test1/fs/fat/dir.c~fat_more-ioctl-fix 2003-07-21 02:48:09.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/fat/dir.c 2003-07-21 02:48:09.000000000 +0900
@@ -647,9 +647,23 @@ int fat_dir_ioctl(struct inode * inode,
unsigned int cmd, unsigned long arg)
{
struct fat_ioctl_filldir_callback buf;
- struct dirent __user *d1 = (struct dirent *)arg;
+ struct dirent __user *d1;
int ret, shortname, both;
+ switch (cmd) {
+ case VFAT_IOCTL_READDIR_SHORT:
+ shortname = 1;
+ both = 1;
+ break;
+ case VFAT_IOCTL_READDIR_BOTH:
+ shortname = 0;
+ both = 1;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ d1 = (struct dirent *)arg;
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct dirent[2])))
return -EFAULT;
/*
@@ -662,20 +676,13 @@ int fat_dir_ioctl(struct inode * inode,
buf.dirent = d1;
buf.result = 0;
- switch (cmd) {
- case VFAT_IOCTL_READDIR_SHORT:
- shortname = 1;
- both = 1;
- break;
- case VFAT_IOCTL_READDIR_BOTH:
- shortname = 0;
- both = 1;
- break;
- default:
- return -EINVAL;
+ down(&inode->i_sem);
+ ret = -ENOENT;
+ if (!IS_DEADDIR(inode)) {
+ ret = fat_readdirx(inode, filp, &buf, fat_ioctl_filldir,
+ shortname, both);
}
- ret = fat_readdirx(inode, filp, &buf, fat_ioctl_filldir,
- shortname, both);
+ up(&inode->i_sem);
if (ret >= 0)
ret = buf.result;
return ret;
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
reply other threads:[~2003-07-21 15:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87oeznx4jg.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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
all inboxes | Powered by JetHome®