Skip to content

Commit

Permalink
cifs: NULL dereference on allocation failure
Browse files Browse the repository at this point in the history
We should just return directly here, the goto causes a NULL dereference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
Dan Carpenter authored and Steve French committed Jan 24, 2012
1 parent c1aab02 commit 803ab97
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3857,10 +3857,8 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
struct smb_vol *vol_info;

vol_info = kzalloc(sizeof(*vol_info), GFP_KERNEL);
if (vol_info == NULL) {
tcon = ERR_PTR(-ENOMEM);
goto out;
}
if (vol_info == NULL)
return ERR_PTR(-ENOMEM);

vol_info->local_nls = cifs_sb->local_nls;
vol_info->linux_uid = fsuid;
Expand Down

0 comments on commit 803ab97

Please sign in to comment.