aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-05-09 02:30:11 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-05-09 17:58:00 -0400
commitddce40df6e14dd474bbd9daa006dcc290dea6326 (patch)
tree29995b5d0ad7fcab114d388b4ab1675e32ba963e
parente4cc6ee2e40bdd57990577b7f851fa2ca48edf47 (diff)
sunrpc: fix crash in rpc_malloc()
While the comment says: * To prevent rpciod from hanging, this allocator never sleeps, * returning NULL if the request cannot be serviced immediately. The function does not actually check for NULL pointers being returned. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/sched.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index b28a0b037f4f..b011eb625e49 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -767,6 +767,10 @@ void *rpc_malloc(struct rpc_task *task, size_t size)
767 buf = mempool_alloc(rpc_buffer_mempool, gfp); 767 buf = mempool_alloc(rpc_buffer_mempool, gfp);
768 else 768 else
769 buf = kmalloc(size, gfp); 769 buf = kmalloc(size, gfp);
770
771 if (!buf)
772 return NULL;
773
770 buf->len = size; 774 buf->len = size;
771 dprintk("RPC: %5u allocated buffer of size %zu at %p\n", 775 dprintk("RPC: %5u allocated buffer of size %zu at %p\n",
772 task->tk_pid, size, buf); 776 task->tk_pid, size, buf);