Commit 04d0f23c authored by Trond Myklebust's avatar Trond Myklebust

From: Dave Jones <davej@redhat.com>

Remove a local 1k array.
parent 863a6d53
...@@ -436,13 +436,13 @@ gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg, ...@@ -436,13 +436,13 @@ gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
return mlen; return mlen;
} }
#define MSG_BUF_MAXSIZE 1024
static ssize_t static ssize_t
gss_pipe_downcall(struct file *filp, const char *src, size_t mlen) gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
{ {
char buf[1024];
struct xdr_netobj obj = { struct xdr_netobj obj = {
.len = mlen, .len = mlen,
.data = buf,
}; };
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_dentry->d_inode;
struct rpc_inode *rpci = RPC_I(inode); struct rpc_inode *rpci = RPC_I(inode);
...@@ -458,11 +458,16 @@ gss_pipe_downcall(struct file *filp, const char *src, size_t mlen) ...@@ -458,11 +458,16 @@ gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
int err; int err;
int gss_err; int gss_err;
if (mlen > sizeof(buf)) if (mlen > MSG_BUF_MAXSIZE)
return -ENOSPC; return -EFBIG;
left = copy_from_user(buf, src, mlen); obj.data = kmalloc(mlen, GFP_KERNEL);
if (left) if (!obj.data)
return -EFAULT; return -ENOMEM;
left = copy_from_user(obj.data, src, mlen);
if (left) {
err = -EFAULT;
goto out;
}
clnt = rpci->private; clnt = rpci->private;
atomic_inc(&clnt->cl_users); atomic_inc(&clnt->cl_users);
auth = clnt->cl_auth; auth = clnt->cl_auth;
...@@ -487,12 +492,15 @@ gss_pipe_downcall(struct file *filp, const char *src, size_t mlen) ...@@ -487,12 +492,15 @@ gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
} else } else
spin_unlock(&gss_auth->lock); spin_unlock(&gss_auth->lock);
rpc_release_client(clnt); rpc_release_client(clnt);
kfree(obj.data);
dprintk("RPC: gss_pipe_downcall returning length %u\n", mlen); dprintk("RPC: gss_pipe_downcall returning length %u\n", mlen);
return mlen; return mlen;
err: err:
if (ctx) if (ctx)
gss_destroy_ctx(ctx); gss_destroy_ctx(ctx);
rpc_release_client(clnt); rpc_release_client(clnt);
out:
kfree(obj.data);
dprintk("RPC: gss_pipe_downcall returning %d\n", err); dprintk("RPC: gss_pipe_downcall returning %d\n", err);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment