Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17926502ybl; Thu, 2 Jan 2020 14:58:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxakBkdxPDrvyRb9Sh1LjMfm52JWTVJ8rUeh0rjGOrMANvuR/Qq9yGu5h92G7hqu6fEnQo2 X-Received: by 2002:a05:6830:451:: with SMTP id d17mr90726380otc.53.1578005911989; Thu, 02 Jan 2020 14:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005911; cv=none; d=google.com; s=arc-20160816; b=Xbg9KVIecYlQoyi44Xjhomcjfq1DkmGeqPnAxpBdalq+j7jjhxVfSPAULMsAGSutQ3 hWxWrBCrBmeje9px+magWz5XnbJdQyxL3jpJMvPtVrHur/viLK8WiXXQpkSwWj0RX7JO 8H/gZ7MoFImhGgVydF5vE9lAsqZ2I7e6SdTSCzasNLY1nsqQVPqdysiE+dHZzR6ZcmSe XcfhEk4RVZDztOmv9DLeO3TeB1npV5vGHv1fsK3XvCJ+vmrMI1Ueur2yRbH91pqi84Ia hbQAORRqWIwsoO5TkmkbXadb68kgJzxYyeFne1/kQOtdHsCumhryfwjvf9bDzoq6+Otc nuAA== 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=qPOKs0w5h8kbkA1LfpV8QOEXanijbshCA9P78PWRziI=; b=X8X/CW3yb7FpaTpYmlbjNwkKvsfnXsO5PI8+J1+WIhHMW2eINVMgEQhCkeL4htQMvq YR//rvB8qsg3rvv4iYWuanqyntBqrhe0x83WbU2u7ySdIW6a0Ax7l73qNtHK3B0bnE6g 68cOO3Ev8YShMMfXpmIJxqZL8iHkFgCLvsNNh0aVXIxcr8hGbCeBa7B1qbUr0KLSazAp //22BV4tzGxXaLaQdVdDMpePjxm4Zze/NxmO2nP9St/Fhicykc1LfhZ2KMs55Ie36rBb yOZ0a1pUWqYRdBUMxqiiCzg1oE4s+lBadCof7oNs28UCXsKGVYdKhURd5eKzOHNaOgN6 Xp7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rRYfJjzo; 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 a9si27764178oib.59.2020.01.02.14.58.20; Thu, 02 Jan 2020 14:58:31 -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=rRYfJjzo; 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 S1727954AbgABWS1 (ORCPT + 99 others); Thu, 2 Jan 2020 17:18:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:33636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728334AbgABWSZ (ORCPT ); Thu, 2 Jan 2020 17:18:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 91A8821582; Thu, 2 Jan 2020 22:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003505; bh=ZRzUaS7TbHRkip6Y5V7m23bnGrNRf3b6ulStmFnU4HQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRYfJjzoLxqB1fED8jOqOgjS49pK67+DX4Iihb1s1J5a05oF/X5u3EKo72Lg/WK2r RVm3RxYFbsJtpUDGI1TYFIiZYYHmL7t5XOpQ+Z8WCp/NrbLXSJbMVIrojJaLkb979s DD0a/LVTVlvm8pOTKVfv26goh5+hQwzgyi5Le73s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Garzarella , "David S. Miller" Subject: [PATCH 5.4 189/191] vhost/vsock: accept only packets with the right dst_cid Date: Thu, 2 Jan 2020 23:07:51 +0100 Message-Id: <20200102215849.847621468@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Stefano Garzarella [ Upstream commit 8a3cc29c316c17de590e3ff8b59f3d6cbfd37b0a ] When we receive a new packet from the guest, we check if the src_cid is correct, but we forgot to check the dst_cid. The host should accept only packets where dst_cid is equal to the host CID. Signed-off-by: Stefano Garzarella Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/vsock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -437,7 +437,9 @@ static void vhost_vsock_handle_tx_kick(s virtio_transport_deliver_tap_pkt(pkt); /* Only accept correctly addressed packets */ - if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid) + if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid && + le64_to_cpu(pkt->hdr.dst_cid) == + vhost_transport_get_local_cid()) virtio_transport_recv_pkt(pkt); else virtio_transport_free_pkt(pkt);