]> err.no Git - linux-2.6/commitdiff
sunrpc: fix crash in rpc_malloc()
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 9 May 2007 06:30:11 +0000 (08:30 +0200)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 9 May 2007 21:58:00 +0000 (17:58 -0400)
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>
net/sunrpc/sched.c

index b28a0b037f4f7d4daf4e01459bef1ff4e312c624..b011eb625e49ca1ce89a1970148170772d257a4c 100644 (file)
@@ -767,6 +767,10 @@ void *rpc_malloc(struct rpc_task *task, size_t size)
                buf = mempool_alloc(rpc_buffer_mempool, gfp);
        else
                buf = kmalloc(size, gfp);
+
+       if (!buf)
+               return NULL;
+
        buf->len = size;
        dprintk("RPC: %5u allocated buffer of size %zu at %p\n",
                        task->tk_pid, size, buf);