From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 45FF17EC4 for ; Wed, 5 Nov 2014 17:44:56 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 05 Nov 2014 08:54:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="411909133" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by FMSMGA003.fm.intel.com with ESMTP; 05 Nov 2014 08:45:44 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 6 Nov 2014 00:52:21 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.202]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.13]) with mapi id 14.03.0195.001; Thu, 6 Nov 2014 00:52:20 +0800 From: "Xie, Huawei" To: "Ouyang, Changchun" , "dev@dpdk.org" Thread-Topic: [PATCH v4 3/3] vhost: Check offset value Thread-Index: AQHP+Meha3NVZg0mcEGtTOMJ2gpW35xSQAJA Date: Wed, 5 Nov 2014 16:52:20 +0000 Message-ID: References: <1415084708-8192-1-git-send-email-changchun.ouyang@intel.com> <1415171435-24252-1-git-send-email-changchun.ouyang@intel.com> <1415171435-24252-4-git-send-email-changchun.ouyang@intel.com> In-Reply-To: <1415171435-24252-4-git-send-email-changchun.ouyang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 3/3] vhost: Check offset value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 16:44:58 -0000 > -----Original Message----- > From: Ouyang, Changchun > Sent: Wednesday, November 05, 2014 12:11 AM > To: dev@dpdk.org > Cc: Xie, Huawei; Ananyev, Konstantin; Cao, Waterman; Ouyang, Changchun > Subject: [PATCH v4 3/3] vhost: Check offset value >=20 > This patch checks the packet length offset value, and checks if the extra= bytes > inside buffer > cross page boundary. >=20 > Signed-off-by: Changchun Ouyang > --- > examples/vhost/main.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 2916313..a93f7a0 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -1110,7 +1110,8 @@ virtio_tx_route(struct vhost_dev *vdev, struct > rte_mbuf *m, uint16_t vlan_tag) > } >=20 > if (vm2vm_mode =3D=3D VM2VM_HARDWARE) { > - if (find_local_dest(dev, m, &offset, &vlan_tag) !=3D 0) { > + if (find_local_dest(dev, m, &offset, &vlan_tag) !=3D 0 || > + offset > rte_pktmbuf_tailroom(m)) { > rte_pktmbuf_free(m); > return; > } > @@ -1896,7 +1897,9 @@ virtio_dev_tx_zcp(struct virtio_net *dev) >=20 > /* Buffer address translation. */ > buff_addr =3D gpa_to_vva(dev, desc->addr); > - phys_addr =3D gpa_to_hpa(vdev, desc->addr, desc->len, > &addr_type); > + /* Need check extra VLAN_HLEN size for inserting VLAN tag */ > + phys_addr =3D gpa_to_hpa(vdev, desc->addr, desc->len + > VLAN_HLEN, > + &addr_type); >=20 > if (likely(packet_success < (free_entries - 1))) > /* Prefetch descriptor index. */ > -- > 1.8.4.2 Why don't we merge 1,2,3 patches?