Skip to content

Commit

Permalink
AFS: Fix possible null pointer dereference in afs_alloc_server()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Denis Kirjanov authored and torvalds committed Jun 1, 2010
1 parent 5c113fb commit 037776f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/afs/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 037776f

Please sign in to comment.