llc: fix info leak via getsockname()
authorMathias Krause <minipli@googlemail.com>
Wed, 15 Aug 2012 11:31:53 +0000 (11:31 +0000)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 10 Feb 2014 21:10:47 +0000 (16:10 -0500)
commitd798b105cee33543b235410d2510219fa887b4d2
tree0f2288de8299d03a00787df26a890a214a1bdd08
parentdbaaf2eb9d0955c2ed5aa9cdd4d8607204ceec22
llc: fix info leak via getsockname()

commit 3592aaeb80290bda0f2cf0b5456c97bfc638b192 upstream.

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: Paul Gortmaker <paul.gortmaker@windriver.com>
net/llc/af_llc.c