aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/gss_spkm3_seal.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2006-03-20 23:23:11 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 23:23:11 -0500
commit9e57b302cf0f27063184196def620f39ca7a5fc6 (patch)
tree3b154f314dfad8c4350af10b87ab7f4759df3f6d /net/sunrpc/auth_gss/gss_spkm3_seal.c
parentSUNRPC: Ensure rpc_call_async() always calls tk_ops->rpc_release() (diff)
downloadlinux-dev-9e57b302cf0f27063184196def620f39ca7a5fc6.tar.xz
linux-dev-9e57b302cf0f27063184196def620f39ca7a5fc6.zip
SUNRPC,RPCSEC_GSS: remove unnecessary kmalloc of a checksum
Remove unnecessary kmalloc of temporary space to hold the md5 result; it's small enough to just put on the stack. This code may be called to process rpc's necessary to perform writes, so there's a potential deadlock whenever we kmalloc() here. After this a couple kmalloc()'s still remain, to be removed soon. This also fixes a rare double-free on error noticed by coverity. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss/gss_spkm3_seal.c')
-rw-r--r--net/sunrpc/auth_gss/gss_spkm3_seal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c
index 86fbf7c3e39c..18c7862bc234 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_seal.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c
@@ -57,7 +57,8 @@ spkm3_make_token(struct spkm3_ctx *ctx,
{
s32 checksum_type;
char tokhdrbuf[25];
- struct xdr_netobj md5cksum = {.len = 0, .data = NULL};
+ char cksumdata[16];
+ struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
struct xdr_netobj mic_hdr = {.len = 0, .data = tokhdrbuf};
int tokenlen = 0;
unsigned char *ptr;
@@ -115,13 +116,11 @@ spkm3_make_token(struct spkm3_ctx *ctx,
dprintk("RPC: gss_spkm3_seal: SPKM_WRAP_TOK not supported\n");
goto out_err;
}
- kfree(md5cksum.data);
/* XXX need to implement sequence numbers, and ctx->expired */
return GSS_S_COMPLETE;
out_err:
- kfree(md5cksum.data);
token->data = NULL;
token->len = 0;
return GSS_S_FAILURE;