WSL2-Linux-Kernel/drivers/net/netdevsim
Dan Carpenter f72207a5c0 netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write()
The simple_write_to_buffer() function is designed to handle partial
writes.  It returns negatives on error, otherwise it returns the number
of bytes that were able to be copied.  This code doesn't check the
return properly.  We only know that the first byte is written, the rest
of the buffer might be uninitialized.

There is no need to use the simple_write_to_buffer() function.
Partial writes are prohibited by the "if (*ppos != 0)" check at the
start of the function.  Just use memdup_user() and copy the whole
buffer.

Fixes: d3cbb907ae ("netdevsim: add ACL trap reporting cookie as a metadata")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/7c1f950b-3a7d-4252-82a6-876e53078ef7@moroto.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-07-12 12:46:35 -07:00
..
Makefile
bpf.c bpf: Introduce device-bound XDP programs 2023-01-23 09:38:10 -08:00
bus.c driver core: bus: mark the struct bus_type for sysfs callbacks as constant 2023-03-23 13:20:40 +01:00
dev.c netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write() 2023-07-12 12:46:35 -07:00
ethtool.c
fib.c
health.c devlink: protect health reporter operation with instance lock 2023-01-19 19:08:37 -08:00
hwstats.c
ipsec.c netdevsim: Fill IPsec state validation failure reason 2023-01-26 16:28:48 -08:00
netdev.c drivers: net: turn on XDP features 2023-02-02 20:48:23 -08:00
netdevsim.h
psample.c
udp_tunnels.c