From: Mathias Krause Date: Wed, 19 Sep 2012 11:33:39 +0000 (+0000) Subject: xfrm_user: fix info leak in copy_to_user_state() X-Git-Tag: Ubuntu-5.2.0-15.16~17238^2~15 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f778a636713a435d3a922c60b1622a91136560c1;p=mirror_ubuntu-eoan-kernel.git xfrm_user: fix info leak in copy_to_user_state() 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 Acked-by: Steffen Klassert Signed-off-by: David S. Miller --- diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 40dd50d6c4cc..d585459dc8bb 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -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));