Skip to content

Commit

Permalink
sunrpc: fix crash in rpc_malloc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Trond Myklebust committed May 9, 2007
1 parent e4cc6ee commit ddce40d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/sunrpc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ddce40d

Please sign in to comment.