Skip to content

Commit 11924ba

Browse files
Jorgen Hansengregkh
authored andcommitted
VMCI: Resource wildcard match fixed
When adding a VMCI resource, the check for an existing entry would ignore that the new entry could be a wildcard. This could result in multiple resource entries that would match a given handle. One disastrous outcome of this is that the refcounting used to ensure that delayed callbacks for VMCI datagrams have run before the datagram is destroyed can be wrong, since the refcount could be increased on the duplicate entry. This in turn leads to a use after free bug. This issue was discovered by Hangbin Liu using KASAN and syzkaller. Fixes: bc63ded ("VMCI: resource object implementation") Reported-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: Adit Ranadive <aditr@vmware.com> Reviewed-by: Vishnu Dasa <vdasa@vmware.com> Signed-off-by: Jorgen Hansen <jhansen@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 018d52e commit 11924ba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/misc/vmw_vmci/vmci_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,5 @@ module_exit(vmci_drv_exit);
113113

114114
MODULE_AUTHOR("VMware, Inc.");
115115
MODULE_DESCRIPTION("VMware Virtual Machine Communication Interface.");
116-
MODULE_VERSION("1.1.5.0-k");
116+
MODULE_VERSION("1.1.6.0-k");
117117
MODULE_LICENSE("GPL v2");

drivers/misc/vmw_vmci/vmci_resource.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ static struct vmci_resource *vmci_resource_lookup(struct vmci_handle handle,
5757

5858
if (r->type == type &&
5959
rid == handle.resource &&
60-
(cid == handle.context || cid == VMCI_INVALID_ID)) {
60+
(cid == handle.context || cid == VMCI_INVALID_ID ||
61+
handle.context == VMCI_INVALID_ID)) {
6162
resource = r;
6263
break;
6364
}

0 commit comments

Comments
 (0)