WSL2-Linux-Kernel/drivers/net/netdevsim
Dan Carpenter 31976c68be netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write()
[ Upstream commit f72207a5c0 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:47:45 +02:00
..
Makefile netdevsim: Add dummy psample implementation 2021-03-14 15:00:43 -07:00
bpf.c netdevsim: Avoid allocation warnings triggered from user space 2022-08-17 14:23:36 +02:00
bus.c Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
dev.c netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write() 2023-07-23 13:47:45 +02:00
ethtool.c netdevsim: don't overwrite read only ethtool parms 2021-12-22 09:32:40 +01:00
fib.c netdevsim: fib: Fix reference count leak on route deletion failure 2022-08-17 14:23:36 +02:00
health.c netdevsim: switch to memdup_user_nul() 2021-03-24 16:26:58 -07:00
ipsec.c net: netdevsim: use xso.real_dev instead of xso.dev in callback functions of struct xfrmdev_ops 2021-07-06 10:36:59 -07:00
netdev.c net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-09-08 12:28:07 +02:00
netdevsim.h netdevsim: Protect both reload_down and reload_up paths 2021-08-06 10:36:36 +01:00
psample.c netdevsim: Only use sampling truncation length when valid 2021-04-22 13:23:56 -07:00
udp_tunnels.c netdevsim: set .owner to THIS_MODULE 2020-11-17 14:08:59 -08:00