diff options
author | Vasiliy Kovalev <kovalev@altlinux.org> | 2024-02-19 13:53:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-13 12:50:17 +0200 |
commit | cc065e1b11a270ebd2b18bbe61f0d6cc8efaa15d (patch) | |
tree | 99a3b9fede542235655c75cb3b2de8ea5ade572b | |
parent | 81a3ce3efd82e0790a6151c3dad6c02570d48816 (diff) | |
download | linux-stable-cc065e1b11a270ebd2b18bbe61f0d6cc8efaa15d.tar.gz linux-stable-cc065e1b11a270ebd2b18bbe61f0d6cc8efaa15d.tar.bz2 linux-stable-cc065e1b11a270ebd2b18bbe61f0d6cc8efaa15d.zip |
VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
commit e606e4b71798cc1df20e987dde2468e9527bd376 upstream.
The changes are similar to those given in the commit 19b070fefd0d
("VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()").
Fix filling of the msg and msg_payload in dg_info struct, which prevents a
possible "detected field-spanning write" of memcpy warning that is issued
by the tracking mechanism __fortify_memcpy_chk.
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Link: https://lore.kernel.org/r/20240219105315.76955-1-kovalev@altlinux.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/vmw_vmci/vmci_datagram.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c index 275542e8b2ad..129dd088866c 100644 --- a/drivers/misc/vmw_vmci/vmci_datagram.c +++ b/drivers/misc/vmw_vmci/vmci_datagram.c @@ -386,7 +386,8 @@ int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg) dg_info->in_dg_host_queue = false; dg_info->entry = dst_entry; - memcpy(&dg_info->msg, dg, VMCI_DG_SIZE(dg)); + dg_info->msg = *dg; + memcpy(&dg_info->msg_payload, dg + 1, dg->payload_size); INIT_WORK(&dg_info->work, dg_delayed_dispatch); schedule_work(&dg_info->work); |