vhost: avoid dead loop chain
authorYuanhan Liu <yuanhan.liu@linux.intel.com>
Thu, 10 Mar 2016 04:32:46 +0000 (12:32 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 14 Mar 2016 23:07:32 +0000 (00:07 +0100)
commita436f53ebfeb5a76df1e2248db8064e9dab8e739
tree680fe0cdd613814d480962d2e9cc474cf7aed79c
parentc687b0b635e29c99f4dc7c91d84849130aeb89ac
vhost: avoid dead loop chain

If a malicious guest forges a dead loop chain, it could lead to a dead
loop of copying the desc buf to mbuf, which results to all mbuf being
exhausted.

Add a var nr_desc to avoid such case.

Suggested-by: Huawei Xie <huawei.xie@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
lib/librte_vhost/vhost_rxtx.c