• David Disseldorp's avatar
    ceph: fix listxattr vxattr buffer length calculation · 2b2abcac
    David Disseldorp authored
    ceph_listxattr() incorrectly returns a length based on the static
    ceph_vxattrs_name_size() value, which only takes into account whether
    vxattrs are hidden, ignoring vxattr.exists_cb().
    
    When filling the xattr buffer ceph_listxattr() checks VXATTR_FLAG_HIDDEN
    and vxattr.exists_cb(). If both are false, we return an incorrect
    (oversize) length.
    
    Fix this behaviour by always calculating the vxattrs length at runtime,
    taking both vxattr.hidden and vxattr.exists_cb() into account.
    
    This bug is only exposed with the new "ceph.snap.btime" vxattr, as all
    other vxattrs with a non-null exists_cb also carry VXATTR_FLAG_HIDDEN.
    Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
    Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
    Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
    2b2abcac
xattr.c 31 KB