linux-stable/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
..
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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-16 16:13:19 -08:00
fib.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-08-03 09:04:55 +02:00
health.c devlink: protect health reporter operation with instance lock 2023-01-19 19:08:37 -08:00
hwstats.c netdevsim: Fix hwstats debugfs file permissions 2022-09-19 14:40:38 -07:00
ipsec.c netdevsim: Fill IPsec state validation failure reason 2023-01-26 16:28:48 -08:00
Makefile netdevsim: Introduce support for L3 offload xstats 2022-03-15 14:00:51 +01:00
netdev.c drivers: net: turn on XDP features 2023-02-02 20:48:23 -08:00
netdevsim.h netdevsim: convert driver to use unlocked devlink API during init/fini 2022-07-18 20:10:48 -07:00
psample.c netdevsim: Only use sampling truncation length when valid 2021-04-22 13:23:56 -07:00
udp_tunnels.c