Commit 650b1c34 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Zheng Zengkai
Browse files

cap: fix conversions on getxattr



stable inclusion
from stable-5.10.17
commit 02dee03d48314b77a3c60091aa10fa721c3d1edd
bugzilla: 48169

--------------------------------

[ Upstream commit f2b00be4 ]

If a capability is stored on disk in v2 format cap_inode_getsecurity() will
currently return in v2 format unconditionally.

This is wrong: v2 cap should be equivalent to a v3 cap with zero rootid,
and so the same conversions performed on it.

If the rootid cannot be mapped, v3 is returned unconverted.  Fix this so
that both v2 and v3 return -EOVERFLOW if the rootid (or the owner of the fs
user namespace in case of v2) cannot be mapped into the current user
namespace.

Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 65d7cc94
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment