android_kernel_xiaomi_sm7250/drivers/ntb
Dan Carpenter 582565415f NTB: ntb_tool: uninitialized heap data in tool_fn_write()
commit 45e1058b77feade4e36402828bfe3e0d3363177b 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:15:39 +02:00
..
hw NTB: hw: amd: fix an issue about leak system resources 2020-10-30 10:38:25 +01:00
test NTB: ntb_tool: uninitialized heap data in tool_fn_write() 2022-08-25 11:15:39 +02:00
Kconfig NTB: Add ping pong test client 2015-07-04 14:07:42 -04:00
Makefile NTB: Add ping pong test client 2015-07-04 14:07:42 -04:00
ntb_transport.c - Error path bug fix for overflow tests (Dan) 2018-06-12 18:28:00 -07:00
ntb.c NTB: Revert the change to use the NTB device dev for DMA allocations 2020-06-25 15:33:03 +02:00