[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20100601161538.2174.57858.stgit@warthog.procyon.org.uk>
Date: Tue, 01 Jun 2010 17:15:39 +0100
From: David Howells <dhowells@...hat.com>
To: torvalds@...l.org, akpm@...ux-foundation.org
Cc: linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org,
Denis Kirjanov <dkirjanov@...nel.org>,
David Howells <dhowells@...hat.com>
Subject: [PATCH] AFS: Fix possible null pointer dereference in
afs_alloc_server()
From: Denis Kirjanov <dkirjanov@...a.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@...nel.org>
Signed-off-by: David Howells <dhowells@...hat.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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists