* [PATCH] AFS: Fix possible null pointer dereference in afs_alloc_server()
@ 2010-06-01 16:15 David Howells
0 siblings, 0 replies; only message in thread
From: David Howells @ 2010-06-01 16:15 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-afs, linux-kernel, Denis Kirjanov, David Howells
From: Denis Kirjanov <dkirjanov@hera.kernel.org>
Fix a possible null pointer dereference in afs_alloc_server(): the server
pointer is NULL if there was an allocation failure, and under such a
condition, we can't dereference it in the _leave() statement.
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/afs/server.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/afs/server.c b/fs/afs/server.c
index f490995..9fdc7fe 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -91,9 +91,10 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell,
memcpy(&server->addr, addr, sizeof(struct in_addr));
server->addr.s_addr = addr->s_addr;
+ _leave(" = %p{%d}", server, atomic_read(&server->usage));
+ } else {
+ _leave(" = NULL [nomem]");
}
-
- _leave(" = %p{%d}", server, atomic_read(&server->usage));
return server;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-01 16:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-01 16:15 [PATCH] AFS: Fix possible null pointer dereference in afs_alloc_server() David Howells
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®