]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
SUNRPC: fix a memleak in gss_import_v2_context
authorZhipeng Lu <alexious@zju.edu.cn>
Sun, 24 Dec 2023 08:20:33 +0000 (16:20 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:36 +0000 (18:19 -0400)
commit99044c01ed5329e73651c054d8a4baacdbb1a27c
tree8f77998b0d1c339e1439e6c361a92524bc943086
parentaf2a9f98d884205145fd155304a6955822ccca1c
SUNRPC: fix a memleak in gss_import_v2_context

[ Upstream commit 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: 47d848077629 ("gss_krb5: handle new context format from gssd")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/auth_gss/gss_krb5_mech.c