xfrm: Zero padding when dumping algos and encap
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Feb 2023 01:09:52 +0000 (09:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:10:37 +0000 (12:10 +0200)
commit5218af4ad5d8948faac19f71583bcd786c3852df
tree810d0f59f0bf0f89f8a06338b83f4c1934ee567d
parent2b4830eefc41b06d4943ae860abf24ec3901d89f
xfrm: Zero padding when dumping algos and encap

[ Upstream commit 8222d5910dae08213b6d9d4bc9a7f8502855e624 ]

When copying data to user-space we should ensure that only valid
data is copied over.  Padding in structures may be filled with
random (possibly sensitve) data and should never be given directly
to user-space.

This patch fixes the copying of xfrm algorithms and the encap
template in xfrm_user so that padding is zeroed.

Reported-by: syzbot+fa5414772d5c445dac3c@syzkaller.appspotmail.com
Reported-by: Hyunwoo Kim <v4bel@theori.io>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xfrm/xfrm_user.c