Commit def52e20 authored by Zhipeng Lu's avatar Zhipeng Lu Committed by Dong Chenchen
Browse files

SUNRPC: fix a memleak in gss_import_v2_context

mainline inclusion
from mainline-v6.9-rc1
commit e67b652d8e8591d3b1e569dbcdfcee15993e91fa
category: bugfix
bugzilla: 189914, https://gitee.com/src-openeuler/kernel/issues/I9L9IF
CVE: CVE-2023-52653

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e67b652d8e8591d3b1e569dbcdfcee15993e91fa



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

The ctx->mech_used.data allocated by kmemdup is not freed in neither
gss_import_v2_context nor it only caller gss_krb5_import_sec_context,
which frees ctx on error.

Thus, this patch reform the last call of gss_import_v2_context to the
gss_krb5_import_ctx_v2, preventing the memleak while keepping the return
formation.

Fixes: 47d84807 ("gss_krb5: handle new context format from gssd")
Signed-off-by: default avatarZhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Conflicts:
	net/sunrpc/auth_gss/gss_krb5_mech.c
[commit 279a67cd was not merged]
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
parent 7d91c9c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment