[PATCH] reiserfs/xattr fix

From: Andries.Brouwer
Date: Fri Aug 27 2004 - 11:09:41 EST


Yesterday or so I wrote:

[Ha, now that I write about the same md5sum: is it well-known
that reiserfs was/is broken? This is what I noticed yesterday
on 2.6.7, have not yet investigated it closely, except for
verifying that coinciding r5 hash is involved.
# mount /dev/xxx /mnt -t reiserfs
# cd /mnt
# echo hoi > ml
# cat na
hoi
# ls -li ml na
9 -rw-r--r-- 1 root root 4 2004-08-25 17:53 ml
9 -rw-r--r-- 1 root root 4 2004-08-25 17:53 na
# rm na
# cat ml
cat: ml: No such file or directory
]

This same bug exists on 2.6.8.1. It is fixed by the patch below.

Andries


diff -uprN -X /linux/dontdiff a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
--- a/fs/reiserfs/xattr.c 2004-06-24 17:11:20.000000000 +0200
+++ b/fs/reiserfs/xattr.c 2004-08-27 17:54:39.000000000 +0200
@@ -1235,7 +1235,13 @@ reiserfs_xattr_unregister_handlers (void
static int
xattr_lookup_poison (struct dentry *dentry, struct qstr *q1, struct qstr *name)
{
- struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root;
+ struct dentry *priv_root;
+
+ /* first the ordinary comparison */
+ if (q1->len != name->len || memcmp(q1->name, name->name, name->len))
+ return -ENOENT;
+ /* when found, reject if private */
+ priv_root = REISERFS_SB(dentry->d_sb)->priv_root;
if (name->len == priv_root->d_name.len &&
name->hash == priv_root->d_name.hash &&
!memcmp (name->name, priv_root->d_name.name, name->len)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/