llc: fix info leak via getsockname()
authorMathias Krause <minipli@googlemail.com>
Wed, 15 Aug 2012 11:31:53 +0000 (11:31 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:04:53 +0000 (15:04 +0100)
commit3f497daadeeb2b84dc8e97b32416d98b34485b99
tree7bf0d70b2450978d06f878e7ea0735920f2ff7f6
parent79690021eba0738861965187af2f75035f846d6f
llc: fix info leak via getsockname()

[ Upstream commit 3592aaeb80290bda0f2cf0b5456c97bfc638b192 ]

The LLC code wrongly returns 0, i.e. "success", when the socket is
zapped. Together with the uninitialized uaddrlen pointer argument from
sys_getsockname this leads to an arbitrary memory leak of up to 128
bytes kernel stack via the getsockname() syscall.

Return an error instead when the socket is zapped to prevent the info
leak. Also remove the unnecessary memset(0). We don't directly write to
the memory pointed by uaddr but memcpy() a local structure at the end of
the function that is properly initialized.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/llc/af_llc.c