Tsutomu Itoh
2011-Jun-28 05:53 UTC
[PATCH v2] Btrfs: fix error check of btrfs_lookup_dentry()
The return value of btrfs_lookup_dentry is checked so that the panic such as illegal address reference should not occur. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> --- V1 -> V2: unnecessary BUG_ON was deleted fs/btrfs/ioctl.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a3c4751..39c62d3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -325,6 +325,7 @@ static noinline int create_subvol(struct btrfs_root *root, struct btrfs_root *new_root; struct dentry *parent = dget_parent(dentry); struct inode *dir; + struct inode *inode; int ret; int err; u64 objectid; @@ -437,7 +438,14 @@ static noinline int create_subvol(struct btrfs_root *root, BUG_ON(ret); - d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry)); + inode = btrfs_lookup_dentry(dir, dentry); + if (IS_ERR(inode)) { + ret = PTR_ERR(inode); + goto fail; + } + BUG_ON(!inode); + + d_instantiate(dentry, inode); fail: dput(parent); if (async_transid) { -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Possibly Parallel Threads
- [PATCH v3] Btrfs: fix error check of btrfs_lookup_dentry()
- [PATCH] Btrfs: fix error check of btrfs_lookup_dentry()
- [PATCH 0/5] asynchronous commit, snapshot ponies
- [PATCH] Btrfs: turn to readonly if btrfs_start_transaction() fails
- [PATCH 2/2] Btrfs: fix unclosed transaction handler when the async transaction commitment fails