lkml.org 
[lkml]   [2012]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] CIFS: Fix NULL pointer dereference in cifs_construct_tcon()
    On Sun, 5 Feb 2012, Jesper Juhl wrote:

    > If the call to kcalloc() fails and returns NULL we'll dereference a

    s/kcalloc/kzalloc/

    > NULL 'vol_info' after we jump to the 'out:' label.
    >
    > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
    > ---
    > fs/cifs/connect.c | 4 ++--
    > 1 files changed, 2 insertions(+), 2 deletions(-)
    >
    > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
    > index 986709a..bd67b7c 100644
    > --- a/fs/cifs/connect.c
    > +++ b/fs/cifs/connect.c
    > @@ -3859,7 +3859,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
    > vol_info = kzalloc(sizeof(*vol_info), GFP_KERNEL);
    > if (vol_info == NULL) {
    > tcon = ERR_PTR(-ENOMEM);
    > - goto out;
    > + goto out2;
    > }
    >
    > vol_info->local_nls = cifs_sb->local_nls;
    > @@ -3901,7 +3901,7 @@ out:
    > kfree(vol_info->username);
    > kfree(vol_info->password);
    > kfree(vol_info);
    > -
    > +out2:
    > return tcon;
    > }
    >
    >

    --
    Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
    Don't top-post http://www.catb.org/jargon/html/T/top-post.html
    Plain text mails only, please.



    \
     
     \ /
      Last update: 2012-02-05 00:39    [W:3.230 / U:1.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site