From: Mathias Krause Date: Sat, 26 Aug 2017 15:08:57 +0000 (+0200) Subject: xfrm_user: fix info leak in copy_user_offload() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5fe0d4bd8f86d19f7f24c1ae5a9b6e6a5a52e51a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git xfrm_user: fix info leak in copy_user_offload() The memory reserved to dump the xfrm offload state includes padding bytes of struct xfrm_user_offload added by the compiler for alignment. Add an explicit memset(0) before filling the buffer to avoid the heap info leak. Cc: Steffen Klassert Fixes: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API") 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 2be4c6af008a..3259555ae7d7 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -796,7 +796,7 @@ static int copy_user_offload(struct xfrm_state_offload *xso, struct sk_buff *skb return -EMSGSIZE; xuo = nla_data(attr); - + memset(xuo, 0, sizeof(*xuo)); xuo->ifindex = xso->dev->ifindex; xuo->flags = xso->flags;