WSL2-Linux-Kernel/drivers/platform/olpc
Dan Carpenter 28621b38ac platform/olpc: Fix uninitialized data in debugfs write
[ Upstream commit 40ec787e1a ]

The call to:

	size = simple_write_to_buffer(cmdbuf, sizeof(cmdbuf), ppos, buf, size);

will succeed if at least one byte is written to the "cmdbuf" buffer.
The "*ppos" value controls which byte is written.  Another problem is
that this code does not check for errors so it's possible for the entire
buffer to be uninitialized.

Inintialize the struct to zero to prevent reading uninitialized stack
data.

Debugfs is normally only writable by root so the impact of this bug is
very minimal.

Fixes: 6cca83d498 ("Platform: OLPC: move debugfs support from x86 EC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YthIKn+TfZSZMEcM@kili
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:23:58 +02:00
..
Kconfig Platform: OLPC: Add a config menu category for XO 1.75 2019-06-12 11:53:20 +03:00
Makefile platform-drivers-x86 for v5.3-1 2019-07-14 16:51:47 -07:00
olpc-ec.c platform/olpc: Fix uninitialized data in debugfs write 2022-08-17 14:23:58 +02:00
olpc-xo175-ec.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00