mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 15:26:21 +09:00
um: ubd: Prevent buffer overrun on command completion
[ Upstream commit 6e682d53fc1ef73a169e2a5300326cb23abb32ee ] On the hypervisor side, when completing commands and the pipe is full, we retry writing only the entries that failed, by offsetting io_req_buffer, but we don't reduce the number of bytes written, which can cause a buffer overrun of io_req_buffer, and write garbage to the pipe. Cc: Martyn Welch <martyn.welch@collabora.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b9f88c31b2
commit
6ba010ea48
|
@ -1606,7 +1606,9 @@ int io_thread(void *arg)
|
|||
written = 0;
|
||||
|
||||
do {
|
||||
res = os_write_file(kernel_fd, ((char *) io_req_buffer) + written, n);
|
||||
res = os_write_file(kernel_fd,
|
||||
((char *) io_req_buffer) + written,
|
||||
n - written);
|
||||
if (res >= 0) {
|
||||
written += res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user