[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9561c78e-49a2-430c-a611-52806c0cdf25@web.de>
Date: Sun, 31 Dec 2023 14:56:11 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-nfs@...r.kernel.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org, Anna Schumaker <anna@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>, Chuck Lever <chuck.lever@...cle.com>,
Dai Ngo <Dai.Ngo@...cle.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Herbert Xu
<herbert@...dor.apana.org.au>, Jakub Kicinski <kuba@...nel.org>,
Jeff Layton <jlayton@...nel.org>, Neil Brown <neilb@...e.de>,
Olga Kornievskaia <kolga@...app.com>, Paolo Abeni <pabeni@...hat.com>,
Simo Sorce <simo@...hat.com>, Tom Talpey <tom@...pey.com>,
Trond Myklebust <trond.myklebust@...merspace.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] sunrpc: Improve exception handling in krb5_etm_checksum()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 31 Dec 2023 14:43:05 +0100
The kfree() function was called in one case by
the krb5_etm_checksum() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus use another label.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index d2b02710ab07..5e2dc3eb8545 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -942,7 +942,7 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher,
/* For RPCSEC, the "initial cipher state" is always all zeroes. */
iv = kzalloc(ivsize, GFP_KERNEL);
if (!iv)
- goto out_free_mem;
+ goto out_free_checksum;
req = ahash_request_alloc(tfm, GFP_KERNEL);
if (!req)
@@ -972,6 +972,7 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher,
ahash_request_free(req);
out_free_mem:
kfree(iv);
+out_free_checksum:
kfree_sensitive(checksumdata);
return err ? GSS_S_FAILURE : GSS_S_COMPLETE;
}
--
2.43.0
Powered by blists - more mailing lists