diff options
author | Jorgen Hansen <jhansen@vmware.com> | 2018-09-21 00:31:05 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-10-02 15:36:10 -0700 |
commit | 11924ba5e671d6caef1516923e2bd8c72929a3fe (patch) | |
tree | ade571c3bcbee5264420e02b2e03830e2ad26802 /drivers/misc/vmw_vmci/vmci_resource.c | |
parent | 018d52e8b589206149be6a929f418379d5c7102d (diff) | |
download | linux-stable-11924ba5e671d6caef1516923e2bd8c72929a3fe.tar.gz linux-stable-11924ba5e671d6caef1516923e2bd8c72929a3fe.tar.bz2 linux-stable-11924ba5e671d6caef1516923e2bd8c72929a3fe.zip |
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: bc63dedb7d46 ("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>
Diffstat (limited to 'drivers/misc/vmw_vmci/vmci_resource.c')
-rw-r--r-- | drivers/misc/vmw_vmci/vmci_resource.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/misc/vmw_vmci/vmci_resource.c b/drivers/misc/vmw_vmci/vmci_resource.c index 1ab6e8737a5f..da1ee2e1ba99 100644 --- a/drivers/misc/vmw_vmci/vmci_resource.c +++ b/drivers/misc/vmw_vmci/vmci_resource.c @@ -57,7 +57,8 @@ static struct vmci_resource *vmci_resource_lookup(struct vmci_handle handle, if (r->type == type && rid == handle.resource && - (cid == handle.context || cid == VMCI_INVALID_ID)) { + (cid == handle.context || cid == VMCI_INVALID_ID || + handle.context == VMCI_INVALID_ID)) { resource = r; break; } |