From: Markus Elfring <Markus.Elfring@web.de>
To: linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, Anna Schumaker <anna@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
Dai Ngo <Dai.Ngo@oracle.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Jakub Kicinski <kuba@kernel.org>,
Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Paolo Abeni <pabeni@redhat.com>, Simo Sorce <simo@redhat.com>,
Tom Talpey <tom@talpey.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] sunrpc: Improve exception handling in krb5_etm_checksum()
Date: Sun, 31 Dec 2023 14:56:11 +0100 [thread overview]
Message-ID: <9561c78e-49a2-430c-a611-52806c0cdf25@web.de> (raw)
From: Markus Elfring <elfring@users.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@users.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
next reply other threads:[~2023-12-31 13:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-31 13:56 Markus Elfring [this message]
2024-01-01 2:18 ` [PATCH] sunrpc: Improve exception handling in krb5_etm_checksum() Chuck Lever
2024-01-01 11:24 ` Markus Elfring
2024-01-01 16:55 ` Chuck Lever
2024-01-02 9:26 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9561c78e-49a2-430c-a611-52806c0cdf25@web.de \
--to=markus.elfring@web.de \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=ardb@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=jlayton@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kolga@netapp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simo@redhat.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox