diff options
author | James Simmons <jsimmons@infradead.org> | 2018-04-16 00:14:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-23 14:57:40 +0200 |
commit | 15f7330be7c0416ea5400dcd286730481c20a84f (patch) | |
tree | 7fa7ec63995e68435a87c7515205369ad01c40b8 /drivers/staging/lustre/lustre/llite | |
parent | staging: lustre: libcfs: use dynamic minors for /dev/{lnet, obd} (diff) | |
download | linux-dev-15f7330be7c0416ea5400dcd286730481c20a84f.tar.xz linux-dev-15f7330be7c0416ea5400dcd286730481c20a84f.zip |
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: b3dd8957c23a ("staging: lustre: lustre: llite: Use kstrdup"
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/llite')
-rw-r--r-- | drivers/staging/lustre/lustre/llite/xattr_cache.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 4dc799d60a9f..ef669495b5d4 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -121,10 +121,12 @@ static int ll_xattr_cache_add(struct list_head *cache, xattr->xe_name = kstrdup(xattr_name, GFP_NOFS); if (!xattr->xe_name) { - CDEBUG(D_CACHE, "failed to alloc xattr name %u\n", - xattr->xe_namelen); + CDEBUG(D_CACHE, "failed to alloc xattr name %s\n", + xattr_name); goto err_name; } + xattr->xe_namelen = strlen(xattr_name) + 1; + xattr->xe_value = kmemdup(xattr_val, xattr_val_len, GFP_NOFS); if (!xattr->xe_value) goto err_value; |