From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, hirofumi@mail.parknet.co.jp
Subject: [PATCH 10/21] vfat: Fix vfat_find() error path in vfat_lookup()
Date: Wed, 15 Oct 2008 22:57:59 +0900 [thread overview]
Message-ID: <db8ca48d3e848f5f6e71022369.ps@mail.parknet.co.jp> (raw)
In-Reply-To: <2f7c69713e848f5f6e6922369.ps@mail.parknet.co.jp>
Current vfat_lookup() creates negetive dentry blindly if vfat_find()
returned a error. It's wrong. If the error isn't -ENOENT, just return
error.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/fat/namei_vfat.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff -puN fs/fat/namei_vfat.c~vfat-lookup-fix-error fs/fat/namei_vfat.c
--- linux-2.6/fs/fat/namei_vfat.c~vfat-lookup-fix-error 2008-08-26 10:59:29.000000000 +0900
+++ linux-2.6-hirofumi/fs/fat/namei_vfat.c 2008-08-26 11:10:23.000000000 +0900
@@ -683,7 +683,7 @@ static struct dentry *vfat_lookup(struct
{
struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo;
- struct inode *inode = NULL;
+ struct inode *inode;
struct dentry *alias;
int err, table;
@@ -693,14 +693,18 @@ static struct dentry *vfat_lookup(struct
err = vfat_find(dir, &dentry->d_name, &sinfo);
if (err) {
- table++;
+ if (err == -ENOENT) {
+ table++;
+ inode = NULL;
+ goto out;
+ }
goto error;
}
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh);
if (IS_ERR(inode)) {
- unlock_super(sb);
- return ERR_CAST(inode);
+ err = PTR_ERR(inode);
+ goto error;
}
alias = d_find_alias(inode);
if (alias) {
@@ -713,7 +717,7 @@ static struct dentry *vfat_lookup(struct
}
}
-error:
+out:
unlock_super(sb);
dentry->d_op = &vfat_dentry_ops[table];
dentry->d_time = dentry->d_parent->d_inode->i_version;
@@ -723,6 +727,10 @@ error:
dentry->d_time = dentry->d_parent->d_inode->i_version;
}
return dentry;
+
+error:
+ unlock_super(sb);
+ return ERR_PTR(err);
}
static int vfat_create(struct inode *dir, struct dentry *dentry, int mode,
_
next prev parent reply other threads:[~2008-10-15 14:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 13:57 [PATCH 01/21] fat: document additional vfat mount options OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 02/21] fat: move fs/vfat/* and fs/msdos/* to fs/fat OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 03/21] fat: split include/msdos_fs.h OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 04/21] fat: Fix and cleanup timestamp conversion OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 05/21] fat: use generic_file_llseek() for directory OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 06/21] fat: cleanup fat_parse_long() error handling OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 07/21] fat: improve fat_hash() OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 08/21] fat: Fix fat_ent_update_ptr() for FAT12 OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 09/21] fat: use fat_detach() in fat_clear_inode() OGAWA Hirofumi
2008-10-15 13:57 ` OGAWA Hirofumi [this message]
2008-10-15 13:57 ` [PATCH 11/21] fat: Fix/Cleanup dcache handling for vfat OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 12/21] fat: Kill d_invalidate() in vfat_lookup() OGAWA Hirofumi
2008-10-15 13:57 ` [PATCH 13/21] fat: Cleanup msdos_lookup() OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 14/21] fat: Cleanup FAT attribute stuff OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 15/21] fat: Fix ATTR_RO in the case of (~umask & S_WUGO) == 0 OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 16/21] fat: Fix ATTR_RO for directory OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 17/21] fat: Fix _fat_bmap() race OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 18/21] fat: Add printf attribute to fat_fs_panic() OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 19/21] fat: mmu_private race fix OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 20/21] fat: ->i_pos " OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 21/21] fat: i_blocks warning fix OGAWA Hirofumi
2009-03-17 23:33 ` [PATCH 02/21] fat: move fs/vfat/* and fs/msdos/* to fs/fat Pozsar Balazs
2008-10-15 22:07 ` [PATCH 01/21] fat: document additional vfat mount options Andrew Morton
2008-10-15 23:04 ` OGAWA Hirofumi
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=db8ca48d3e848f5f6e71022369.ps@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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®