Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359624
b: refs/heads/master
c: b65917d
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Feb 14, 2013
1 parent d35496b commit 6720528
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bee82fb4b8d49541fe474ed460d2b917f329568
refs/heads/master: b65917dd2700b7d12e25e2e0bbfd58eb3c932158
19 changes: 13 additions & 6 deletions trunk/fs/ceph/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,23 +657,30 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
vir_namelen = ceph_vxattrs_name_size(vxattrs);

/* adding 1 byte per each variable due to the null termination */
namelen = vir_namelen + ci->i_xattrs.names_size + ci->i_xattrs.count;
namelen = ci->i_xattrs.names_size + ci->i_xattrs.count;
err = -ERANGE;
if (size && namelen > size)
if (size && vir_namelen + namelen > size)
goto out;

err = namelen;
err = namelen + vir_namelen;
if (size == 0)
goto out;

names = __copy_xattr_names(ci, names);

/* virtual xattr names, too */
if (vxattrs)
err = namelen;
if (vxattrs) {
for (i = 0; vxattrs[i].name; i++) {
len = sprintf(names, "%s", vxattrs[i].name);
names += len + 1;
if (!vxattrs[i].hidden &&
!(vxattrs[i].exists_cb &&
!vxattrs[i].exists_cb(ci))) {
len = sprintf(names, "%s", vxattrs[i].name);
names += len + 1;
err += len + 1;
}
}
}

out:
spin_unlock(&ci->i_ceph_lock);
Expand Down

0 comments on commit 6720528

Please sign in to comment.