[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100530075927.GA4912@hera.kernel.org>
Date: Sun, 30 May 2010 07:59:27 +0000
From: Denis Kirjanov <dkirjanov@...a.kernel.org>
To: dhowells@...hat.com
Cc: linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] afs: fix possible null pointer dereference in
afs_alloc_server
Fix possible null pointer dereference since kzalloc can return null
Signed-off-by: Denis Kirjanov <dkirjanov@...nel.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;
}
--
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