linux-stable/drivers/ntb
Dan Carpenter 5c21186c5f NTB: ntb_tool: uninitialized heap data in tool_fn_write()
commit 45e1058b77 upstream.

The call to:

	ret = simple_write_to_buffer(buf, size, offp, ubuf, size);

will return success if it is able to write even one byte to "buf".
The value of "*offp" controls which byte.  This could result in
reading uninitialized data when we do the sscanf() on the next line.

This code is not really desigined to handle partial writes where
*offp is non-zero and the "buf" is preserved and re-used between writes.
Just ban partial writes and replace the simple_write_to_buffer() with
copy_from_user().

Fixes: 578b881ba9 ("NTB: Add tool test client")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:40:14 +02:00
..
hw ntb: intel: fix port config status offset for SPR 2022-03-08 19:12:44 +01:00
test NTB: ntb_tool: uninitialized heap data in tool_fn_write() 2022-08-25 11:40:14 +02:00
core.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
Kconfig
Makefile
msi.c NTB/msi: Use irq_has_action() 2020-12-15 16:19:32 +01:00
ntb_transport.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00