can: bcm: fix infoleak in struct bcm_msg_head
authorNorbert Slusarek <nslusarek@gmx.net>
Sat, 12 Jun 2021 20:18:54 +0000 (22:18 +0200)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:48:52 +0000 (08:48 -0400)
commit4fa028860bb1656f370851c2c26de15fc67da300
tree345cf7c16b207928e29999648764222c16d7d5c7
parent23f97d0f3176636dbb2ffd10a1a03efd70be5290
can: bcm: fix infoleak in struct bcm_msg_head

commit 5e87ddbe3942e27e939bdc02deb8579b0cbd8ecc upstream.

On 64-bit systems, struct bcm_msg_head has an added padding of 4 bytes between
struct members count and ival1. Even though all struct members are initialized,
the 4-byte hole will contain data from the kernel stack. This patch zeroes out
struct bcm_msg_head before usage, preventing infoleaks to userspace.

Fixes: ffd980f976e7 ("[CAN]: Add broadcast manager (bcm) protocol")
Link: https://lore.kernel.org/r/trinity-7c1b2e82-e34f-4885-8060-2cd7a13769ce-1623532166177@3c-app-gmx-bs52
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/can/bcm.c