]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
xfrm_user: fix info leak in copy_to_user_state()
authorMathias Krause <minipli@googlemail.com>
Wed, 19 Sep 2012 11:33:39 +0000 (11:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Sep 2012 22:08:39 +0000 (18:08 -0400)
The memory reserved to dump the xfrm state includes the padding bytes of
struct xfrm_usersa_info added by the compiler for alignment (7 for
amd64, 3 for i386). Add an explicit memset(0) before filling the buffer
to avoid the info leak.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_user.c

index 40dd50d6c4cc31efec38b9525f88056269df9a4a..d585459dc8bb541f6c6e115dd585fbd04bf6ded6 100644 (file)
@@ -689,6 +689,7 @@ out:
 
 static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
 {
+       memset(p, 0, sizeof(*p));
        memcpy(&p->id, &x->id, sizeof(p->id));
        memcpy(&p->sel, &x->sel, sizeof(p->sel));
        memcpy(&p->lft, &x->lft, sizeof(p->lft));