kernel/sys.c: avoid copying possible padding bytes in copy_to_user
authorJoe Perches <joe@perches.com>
Thu, 5 Dec 2019 00:50:53 +0000 (16:50 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 18:40:04 +0000 (20:40 +0200)
commitbab62c69778f4eaf79ca0beb62d3290c4e494464
tree0327083b4c4254dfa4c3b6cb0359a327b09b44f0
parent90b58f825e9b6eac7bc625394ac129e751da73d2
kernel/sys.c: avoid copying possible padding bytes in copy_to_user

[ Upstream commit 5e1aada08cd19ea652b2d32a250501d09b02ff2e ]

Initialization is not guaranteed to zero padding bytes so use an
explicit memset instead to avoid leaking any kernel content in any
possible padding bytes.

Link: http://lkml.kernel.org/r/dfa331c00881d61c8ee51577a082d8bebd61805c.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sys.c