Skip to content

Commit

Permalink
reiserfs: Fix warning and inode leak when deleting inode with xattrs
Browse files Browse the repository at this point in the history
After commit 21d8a15 (lookup_one_len: don't accept . and ..) reiserfs
started failing to delete xattrs from inode. This was due to a buggy
test for '.' and '..' in fill_with_dentries() which resulted in passing
'.' and '..' entries to lookup_one_len() in some cases. That returned
error and so we failed to iterate over all xattrs of and inode.

Fix the test in fill_with_dentries() along the lines of the one in
lookup_one_len().

Reported-by: Pawel Zawora <pzawora@gmail.com>
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Mar 29, 2013
1 parent a8c4528 commit 35e5cbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/reiserfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset,
if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
return -ENOSPC;

if (name[0] == '.' && (name[1] == '\0' ||
(name[1] == '.' && name[2] == '\0')))
if (name[0] == '.' && (namelen < 2 ||
(namelen == 2 && name[1] == '.')))
return 0;

dentry = lookup_one_len(name, dbuf->xadir, namelen);
Expand Down

0 comments on commit 35e5cbc

Please sign in to comment.