提交 15f7330b 编写于 作者: J James Simmons 提交者: Greg Kroah-Hartman

staging: lustre: llite: initialize xattr->xe_namelen

When the allocation of xattr->xe_name was moved to kstrdup()
setting xattr->xe_namelen was dropped. This field is used
in several parts of the xattr cache code so it broke xattr
handling. Initialize xattr->xe_namelen when allocating
xattr->xe_name succeeds. Also change the debugging statement
to really report the xattr name instead of its length which
wasn't event being set.

Fixes: b3dd8957 ("staging: lustre: lustre: llite: Use kstrdup"
Signed-off-by: NJames Simmons <jsimmons@infradead.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ba833f14
...@@ -121,10 +121,12 @@ static int ll_xattr_cache_add(struct list_head *cache, ...@@ -121,10 +121,12 @@ static int ll_xattr_cache_add(struct list_head *cache,
xattr->xe_name = kstrdup(xattr_name, GFP_NOFS); xattr->xe_name = kstrdup(xattr_name, GFP_NOFS);
if (!xattr->xe_name) { if (!xattr->xe_name) {
CDEBUG(D_CACHE, "failed to alloc xattr name %u\n", CDEBUG(D_CACHE, "failed to alloc xattr name %s\n",
xattr->xe_namelen); xattr_name);
goto err_name; goto err_name;
} }
xattr->xe_namelen = strlen(xattr_name) + 1;
xattr->xe_value = kmemdup(xattr_val, xattr_val_len, GFP_NOFS); xattr->xe_value = kmemdup(xattr_val, xattr_val_len, GFP_NOFS);
if (!xattr->xe_value) if (!xattr->xe_value)
goto err_value; goto err_value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册