Re: [patch] cifs: NULL dereference on allocation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merged into cifs-2.6.git

On Tue, Jan 24, 2012 at 2:39 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> We should just return directly here, the goto causes a NULL dereference.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 986709a..026d646 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -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;



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux