Commit a42d3e30 authored by Ondrej Mosnacek's avatar Ondrej Mosnacek Committed by Zheng Zengkai
Browse files

selinux: fix bad cleanup on error in hashtab_duplicate()

stable inclusion
from stable-v5.10.118
commit b42e5e3a84ddbcbb104d7c69003aac806cdcdf26
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L686

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b42e5e3a84ddbcbb104d7c69003aac806cdcdf26



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

commit 6254bd3d upstream.

The code attempts to free the 'new' pointer using kmem_cache_free(),
which is wrong because this function isn't responsible of freeing it.
Instead, the function should free new->htable and clear the contents of
*new (to prevent double-free).

Cc: stable@vger.kernel.org
Fixes: c7c556f1 ("selinux: refactor changing booleans")
Reported-by: default avatarWander Lairson Costa <wander@redhat.com>
Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 854b21e9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment