• Jeff Layton's avatar
    cifs: fix pointer initialization and checks in cifs_follow_symlink (try #4) · 8b6427a2
    Jeff Layton authored
    This is the third respin of the patch posted yesterday to fix the error
    handling in cifs_follow_symlink. It also includes a fix for a bogus NULL
    pointer check in CIFSSMBQueryUnixSymLink that Jeff Moyer spotted.
    
    It's possible for CIFSSMBQueryUnixSymLink to return without setting
    target_path to a valid pointer. If that happens then the current value
    to which we're initializing this pointer could cause an oops when it's
    kfree'd.
    
    This patch is a little more comprehensive than the last patches. It
    reorganizes cifs_follow_link a bit for (hopefully) better readability.
    It should also eliminate the uneeded allocation of full_path on servers
    without unix extensions (assuming they can get to this point anyway, of
    which I'm not convinced).
    
    On a side note, I'm not sure I agree with the logic of enabling this
    query even when unix extensions are disabled on the client. It seems
    like that should disable this as well. But, changing that is outside the
    scope of this fix, so I've left it alone for now.
    Reported-by: default avatarJeff Moyer <jmoyer@redhat.com>
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@inraded.com>
    Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
    8b6427a2
link.c 5.98 KB