mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sunrpc: fix crash in rpc_malloc()
@ 2007-05-09  6:30 Peter Zijlstra
  0 siblings, 0 replies; only message in thread
From: Peter Zijlstra @ 2007-05-09  6:30 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel, Andrew Morton


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>
---
 net/sunrpc/sched.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6-git/net/sunrpc/sched.c
===================================================================
--- linux-2.6-git.orig/net/sunrpc/sched.c
+++ linux-2.6-git/net/sunrpc/sched.c
@@ -762,6 +762,10 @@ void *rpc_malloc(struct rpc_task *task, 
 		buf = mempool_alloc(rpc_buffer_mempool, gfp);
 	else
 		buf = kmalloc(size, gfp);
+
+	if (!buf)
+		return NULL;
+
 	*buf = size;
 	dprintk("RPC: %5u allocated buffer of size %zu at %p\n",
 			task->tk_pid, size, buf);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-09  6:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09  6:30 [PATCH] sunrpc: fix crash in rpc_malloc() Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®