All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] hw/pvrdma: Protect against buggy or malicious guest driver
@ 2022-04-03  9:52 Yuval Shaia
  2022-04-05 10:31 ` Marcel Apfelbaum
  2022-09-12 17:45 ` Michael Tokarev
  0 siblings, 2 replies; 10+ messages in thread
From: Yuval Shaia @ 2022-04-03  9:52 UTC (permalink / raw)
  To: qemu-devel, yuval.shaia.ml, marcel.apfelbaum, mcascell, wxhusst

Guest driver might execute HW commands when shared buffers are not yet
allocated.
This could happen on purpose (malicious guest) or because of some other
guest/host address mapping error.
We need to protect againts such case.

Fixes: CVE-2022-1050

Reported-by: Raven <wxhusst@gmail.com>
Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
---
v1 -> v2:
	* Commit message changes
v2 -> v3:
	* Exclude cosmetic changes
---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
index da7ddfa548..89db963c46 100644
--- a/hw/rdma/vmw/pvrdma_cmd.c
+++ b/hw/rdma/vmw/pvrdma_cmd.c
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-15 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-03  9:52 [PATCH v3] hw/pvrdma: Protect against buggy or malicious guest driver Yuval Shaia
2022-04-05 10:31 ` Marcel Apfelbaum
2022-12-07 15:05   ` Claudio Fontana
2022-12-19  9:57     ` Yuval Shaia
2022-12-19 11:21       ` Marcel Apfelbaum
2022-12-28 19:32         ` Thomas Huth
2023-01-16 17:50           ` Laurent Vivier
2023-05-15 16:08             ` Michael Tokarev
     [not found]             ` <147b4e5e-009a-7ab8-7dfc-ea7735319c97@tls.msk.ru>
2023-05-15 16:09               ` Michael Tokarev
2022-09-12 17:45 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.