From: Mathias Krause Date: Sat, 26 Aug 2017 15:08:58 +0000 (+0200) Subject: xfrm_user: fix info leak in xfrm_notify_sa() X-Git-Tag: v4.14-rc1~190^2~16^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50329c8a340c9dea60d837645fcf13fc36bfb84d;p=platform%2Fkernel%2Flinux-rpi3.git xfrm_user: fix info leak in xfrm_notify_sa() The memory reserved to dump the ID of the xfrm state includes a padding byte in struct xfrm_usersa_id added by the compiler for alignment. To prevent the heap info leak, memset(0) the whole struct before filling it. Cc: Herbert Xu Fixes: 0603eac0d6b7 ("[IPSEC]: Add XFRMA_SA/XFRMA_POLICY for delete notification") Signed-off-by: Mathias Krause Signed-off-by: Steffen Klassert --- diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 3259555..c33516e 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2715,6 +2715,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, const struct km_event *c) struct nlattr *attr; id = nlmsg_data(nlh); + memset(id, 0, sizeof(*id)); memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr)); id->spi = x->id.spi; id->family = x->props.family;