]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
net: Fix references to out-of-scope variables in put_cmsg_compat()
authorJesper Juhl <jj@chaosbits.net>
Sun, 22 Jul 2012 11:37:20 +0000 (11:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Aug 2012 15:31:42 +0000 (08:31 -0700)
commit4deb65e759dd2ff7dd5e40bd6d4bf0dad6d88269
treef3df7cc13f2bb4238e1ec23cf1fcdcf375404ff3
parenta080e65186d367508e2b4e68290656ddce493136
net: Fix references to out-of-scope variables in put_cmsg_compat()

[ Upstream commit 818810472b129004c16fc51bf0a570b60776bfb7 ]

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: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/compat.c