linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reiserfs: Fix warning and inode leak when deleting inode with xattrs
@ 2013-03-29 16:09 Jan Kara
  2013-04-22 14:04 ` Carlos Maiolino
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2013-03-29 16:09 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: reiserfs-devel, Pawel Zawora, Jan Kara, stable

After commit 21d8a15a (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>
---
 fs/reiserfs/xattr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index c196369..4cce1d9 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -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);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] reiserfs: Fix warning and inode leak when deleting inode with xattrs
  2013-03-29 16:09 [PATCH] reiserfs: Fix warning and inode leak when deleting inode with xattrs Jan Kara
@ 2013-04-22 14:04 ` Carlos Maiolino
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos Maiolino @ 2013-04-22 14:04 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, reiserfs-devel, Pawel Zawora, stable

Looks good to me

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

On Fri, Mar 29, 2013 at 05:09:44PM +0100, Jan Kara wrote:
> After commit 21d8a15a (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>
> ---
>  fs/reiserfs/xattr.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
> index c196369..4cce1d9 100644
> --- a/fs/reiserfs/xattr.c
> +++ b/fs/reiserfs/xattr.c
> @@ -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);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Carlos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-22 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-29 16:09 [PATCH] reiserfs: Fix warning and inode leak when deleting inode with xattrs Jan Kara
2013-04-22 14:04 ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).