]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ceph: return -ERANGE if virtual xattr value didn't fit in buffer
authorJeff Layton <jlayton@kernel.org>
Thu, 13 Jun 2019 19:17:00 +0000 (15:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Aug 2019 17:05:22 +0000 (19:05 +0200)
commita065f662da7fadc8cc775b10aa21222b6692c9c0
tree9930d2532603cc1c2aeabc719796b08b482761a8
parent64672c1f2cfe2ad9be4dddf7d7f8838cf80e1e62
ceph: return -ERANGE if virtual xattr value didn't fit in buffer

[ Upstream commit 3b421018f48c482bdc9650f894aa1747cf90e51d ]

The getxattr manpage states that we should return ERANGE if the
destination buffer size is too small to hold the value.
ceph_vxattrcb_layout does this internally, but we should be doing
this for all vxattrs.

Fix the only caller of getxattr_cb to check the returned size
against the buffer length and return -ERANGE if it doesn't fit.
Drop the same check in ceph_vxattrcb_layout and just rely on the
caller to handle it.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Acked-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/xattr.c