Skip to content
  • Jesper Juhl's avatar
    net: Fix references to out-of-scope variables in put_cmsg_compat() · 81881047
    Jesper Juhl authored
    
    
    In net/compat.c::put_cmsg_compat() we may assign 'data' the address of
    either the 'ctv' or 'cts' local variables inside the 'if
    (!COMPAT_USE_64BIT_TIME)' branch.
    
    Those variables go out of scope at the end of the 'if' statement, so
    when we use 'data' further down in 'copy_to_user(CMSG_COMPAT_DATA(cm),
    data, cmlen - sizeof(struct compat_cmsghdr))' there's no telling what
    it may be refering to - not good.
    
    Fix the problem by simply giving 'ctv' and 'cts' function scope.
    
    Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    81881047