提交 ddce40df 编写于 作者: P Peter Zijlstra 提交者: Trond Myklebust

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: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 e4cc6ee2
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册