public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] afs: fix possible null pointer dereference in afs_alloc_server
@ 2010-05-30  7:59 Denis Kirjanov
  2010-06-01 15:47 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Kirjanov @ 2010-05-30  7:59 UTC (permalink / raw)
  To: dhowells; +Cc: linux-afs, linux-kernel

Fix possible null pointer dereference since kzalloc can return null

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
fs/afs/server.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/afs/server.c b/fs/afs/server.c
index f490995..32e2a91 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -93,7 +93,10 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell,
 		server->addr.s_addr = addr->s_addr;
 	}
 
-	_leave(" = %p{%d}", server, atomic_read(&server->usage));
+	if (likely(server))
+		_leave(" = %p{%d}", server, atomic_read(&server->usage));
+	else
+		_leave(" = -ENOMEM");
 	return server;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-01 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-30  7:59 [PATCH] afs: fix possible null pointer dereference in afs_alloc_server Denis Kirjanov
2010-06-01 15:47 ` David Howells

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