Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3436804imu; Sun, 11 Nov 2018 15:04:36 -0800 (PST) X-Google-Smtp-Source: AJdET5dYzUDKl26jUzLIeMEV4oXJIq2FvngcBSQq/FX+3QgOEc84ygOvxR5NuhUQumgnGeEdW0Cy X-Received: by 2002:a17:902:887:: with SMTP id 7-v6mr9817797pll.283.1541977476078; Sun, 11 Nov 2018 15:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977476; cv=none; d=google.com; s=arc-20160816; b=G5mGpGqHACYFfWRM2GmWOZcAD8UGZQ8mBWRRt97g46ErIIUiwEk4nBeu5+Fe5TXbk6 IxI82LJykDCLFlNcPv/Gw0Xtuq2zJz9HgPWcjnIqMc8Tp4jpldNFug6pqUMibL9P9sMG KB1Fn+lYn6zWDvIeETBfQ7Xw+KT/UfYYhBUJUUvbaqzR0r4bhJgE5uTWdpvSY3lAeii+ CrdgN/jjZWTWeBaKyvwxkghynb6edac6QUArNYa2R4IPmRkdBtfCcARGdTGC0fRkCGnB UNkytdzUzXPnIISK9Z6Wxieh9OFjxfYzBpAnU6EPr2C3Gmk50TYDjjucqCCQbRUlsbXl cr4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CTe/QHWX4aYreKth6oxy1DAd0CZ9dqjgJDchRAMywUw=; b=0Rj7B8kC99jq71uLgkqfydPJBEZCUZr2YKfwTOIYJZPQJNM27b1Ls47VPgeCDp6gd9 OVKXzpennffHuq1jFUwCL4TNvVm0OdVC/tGL4qI1ovLdC35fqOHzAVFB3wP8XlchZwBd pkz/vJm/DVEuxwCGchVvmsnnAT+I+714jRsmW/fj4EbDgx56/k8RtoNoqfowrE3+VIiR UgtgjJqpkSuBccnqDDVKYRIHzfEViMgw1t1yCcYlTxS4u090Wu17t/i4Atx7kdZ3swRS FLR28NOUAnMD5qDxfVAXVaT9R9dnTvaSXJVn7mjA6zA60isWTOaXUm+pZNdItcCL6d7R tX0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2RJ1Z238; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b94-v6si16293043plb.396.2018.11.11.15.04.20; Sun, 11 Nov 2018 15:04:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2RJ1Z238; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390613AbeKLIW1 (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:51836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390563AbeKLIW0 (ORCPT ); Mon, 12 Nov 2018 03:22:26 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFE7322353; Sun, 11 Nov 2018 22:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975549; bh=J5Gz00pdrc0fgT6ZYhF9o1tRWguOwyOvRnnUvvX09tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2RJ1Z238IkQffhDoOPa6QgocwL42/JQt8xeIxAcXcM5JFlFXa5GNVfQz47bbYI9jA tarmD7ClY4T2S9MitxL8xR0NTeRYi/3ZWQCf87QcVSAG3lX2bjlYYX9EMxijtoRrYg yh+g892udyuB6sG8twGD89AHdYhXK2MjSTrOuNlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangbin Liu , Adit Ranadive , Vishnu Dasa , Jorgen Hansen , Sasha Levin Subject: [PATCH 4.14 088/222] VMCI: Resource wildcard match fixed Date: Sun, 11 Nov 2018 14:23:05 -0800 Message-Id: <20181111221655.885257479@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jorgen Hansen [ Upstream commit 11924ba5e671d6caef1516923e2bd8c72929a3fe ] 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 Reviewed-by: Adit Ranadive Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/misc/vmw_vmci/vmci_driver.c | 2 +- drivers/misc/vmw_vmci/vmci_resource.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/drivers/misc/vmw_vmci/vmci_driver.c +++ b/drivers/misc/vmw_vmci/vmci_driver.c @@ -113,5 +113,5 @@ module_exit(vmci_drv_exit); MODULE_AUTHOR("VMware, Inc."); MODULE_DESCRIPTION("VMware Virtual Machine Communication Interface."); -MODULE_VERSION("1.1.5.0-k"); +MODULE_VERSION("1.1.6.0-k"); MODULE_LICENSE("GPL v2"); --- 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_resour 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; }