Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17923364ybl; Thu, 2 Jan 2020 14:54:15 -0800 (PST) X-Google-Smtp-Source: APXvYqy7jT5fxNwrYerKU+LSLD1+pJiJXS4dXpXzo3Dgo5Tdo6iignvLXohIAUKnsjuUgMlo7OHz X-Received: by 2002:a05:6830:15a:: with SMTP id j26mr90537663otp.137.1578005654773; Thu, 02 Jan 2020 14:54:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005654; cv=none; d=google.com; s=arc-20160816; b=HKWzR2CdvvCw0TZ6FcsZd9NVSY7UG5b3xmzjiCDQ4c3GQLBkhLdDwGKJwUxTXrmyYT bo3zl4q226ZbDDIScbpwdk6vcDTso3HglpCdTsadpw9CW0kkx8gASwJhvR8vYDHAFaLM +JWxUM2P1y3MBZ6HPA02XbrYPOkf5/bduBLCaL/CcuKD+UcvfdQ26p6oYXEQWKBqHT3C uCH+TRrIwC4ERcteWKrRoph23ruQ+Wz8oAjSebnsn76er4Kh7beQo0zDmtA8z6v5CMwj CK124ONIfDzdHUUGiR7Gp02EWVcyqCf+k7m2s703n391ix2OfD9Di989N74zkVT2Hx9l kKWg== 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=NYboowt3DX1XJnoQuGJOQHN1iSYhodxu3JD5G0BnFK0=; b=WiwFXHzCwuV8KFTcV8ebHuDw3EAu5VoZnZQm1RHvcJWUqodxiVpxvr+/qa5MNaF8Zc OvFJyEH81YR4sDWJdpRv33Oo4mxb2nIZQ1ZXDkJq3rSVBOwQDvd8SjsqBZiSJdZ6+cKJ Y48PCOeHGn77we4S0RE8pcuc/Eno0cg94IxMhYRLp50JVy4qkeQwBZADBrnEHFAd3upO jghaTASt+bzbD3wLZNV5NffaSQuqkjs2/X2sI3TeEdK8h4sGFehW8D7M5AV4NZGrYtJ3 HmLsXUEVWFYZA/gNf067Mr7s52wP4Jo7eA8e/D/dbjcviHXlWgsvRzHHeuqXo293NnvP R1pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SF0gSKeo; 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 b25si27560911otp.212.2020.01.02.14.54.03; Thu, 02 Jan 2020 14:54:14 -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=SF0gSKeo; 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 S1728716AbgABWW2 (ORCPT + 99 others); Thu, 2 Jan 2020 17:22:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:42920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728788AbgABWWZ (ORCPT ); Thu, 2 Jan 2020 17:22: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 7E92420866; Thu, 2 Jan 2020 22:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003745; bh=ZkEToZ9kZMhEnnK6bd6YMhqCMwF2xVX5AH3G3JiaVE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SF0gSKeogOt7bXufzaOyif+ieouaLMOdTkEaxIZlzFQtg/FYJVNDIUe9KCy5GNY4t WdWtfivsyBNV0lkHbg18DbTacH3KD4907PxDa5iMt03dZdt7ZS/ZwIeG/XzO+talHZ 5dVvOwzIhdE6eCP/8O/yXTMahNWGFW1PZrvI16Gg= 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 4.19 096/114] vhost/vsock: accept only packets with the right dst_cid Date: Thu, 2 Jan 2020 23:07:48 +0100 Message-Id: <20200102220038.848209888@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@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 @@ -436,7 +436,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);