diff --git a/patches.suse/SUNRPC-fix-some-memleaks-in-gssx_dec_option_array.patch b/patches.suse/SUNRPC-fix-some-memleaks-in-gssx_dec_option_array.patch new file mode 100644 index 0000000..3ad3cff --- /dev/null +++ b/patches.suse/SUNRPC-fix-some-memleaks-in-gssx_dec_option_array.patch @@ -0,0 +1,80 @@ +From: Zhipeng Lu +Date: Tue, 2 Jan 2024 13:38:13 +0800 +Subject: [PATCH] SUNRPC: fix some memleaks in gssx_dec_option_array +Git-commit: 3cfcfc102a5e57b021b786a755a38935e357797d +Patch-mainline: v6.9-rc1 +References: git-fixes + +The creds and oa->data need to be freed in the error-handling paths after +their allocation. So this patch add these deallocations in the +corresponding paths. + +Fixes: 1d658336b05f ("SUNRPC: Add RPC based upcall mechanism for RPCGSS auth") +Signed-off-by: Zhipeng Lu +Signed-off-by: Chuck Lever +Acked-by: NeilBrown + +--- + net/sunrpc/auth_gss/gss_rpc_xdr.c | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c ++++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c +@@ -250,8 +250,8 @@ static int gssx_dec_option_array(struct + + creds = kzalloc(sizeof(struct svc_cred), GFP_KERNEL); + if (!creds) { +- kfree(oa->data); +- return -ENOMEM; ++ err = -ENOMEM; ++ goto free_oa; + } + + oa->data[0].option.data = CREDS_VALUE; +@@ -265,29 +265,40 @@ static int gssx_dec_option_array(struct + + /* option buffer */ + p = xdr_inline_decode(xdr, 4); +- if (unlikely(p == NULL)) +- return -ENOSPC; ++ if (unlikely(p == NULL)) { ++ err = -ENOSPC; ++ goto free_creds; ++ } + + length = be32_to_cpup(p); + p = xdr_inline_decode(xdr, length); +- if (unlikely(p == NULL)) +- return -ENOSPC; ++ if (unlikely(p == NULL)) { ++ err = -ENOSPC; ++ goto free_creds; ++ } + + if (length == sizeof(CREDS_VALUE) && + memcmp(p, CREDS_VALUE, sizeof(CREDS_VALUE)) == 0) { + /* We have creds here. parse them */ + err = gssx_dec_linux_creds(xdr, creds); + if (err) +- return err; ++ goto free_creds; + oa->data[0].value.len = 1; /* presence */ + } else { + /* consume uninteresting buffer */ + err = gssx_dec_buffer(xdr, &dummy); + if (err) +- return err; ++ goto free_creds; + } + } + return 0; ++ ++free_creds: ++ kfree(creds); ++free_oa: ++ kfree(oa->data); ++ oa->data = NULL; ++ return err; + } + + static int gssx_dec_status(struct xdr_stream *xdr, diff --git a/series.conf b/series.conf index dcd1255..f968bb7 100644 --- a/series.conf +++ b/series.conf @@ -45587,6 +45587,7 @@ patches.suse/arm64-dts-allwinner-h6-Add-RX-DMA-channel-for-SPDIF.patch patches.suse/arm64-dts-imx8mm-venice-gw71xx-fix-USB-OTG-VBUS-2.patch patches.suse/SUNRPC-fix-a-memleak-in-gss_import_v2_context.patch + patches.suse/SUNRPC-fix-some-memleaks-in-gssx_dec_option_array.patch patches.suse/doc-guide-kernel-doc-tell-about-object-like-macros.patch patches.suse/wifi-b43-Stop-wake-correct-queue-in-DMA-Tx-path-when.patch patches.suse/wifi-b43-Stop-wake-correct-queue-in-PIO-Tx-path-when.patch