vhost: validate untrusted memory regions number field
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 5 Feb 2018 12:16:00 +0000 (13:16 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:42 +0000 (14:08 +0200)
commit4d490c7ce392d4307c9ad6009729a8279646cf6c
treec8a532487b0472ffd0f97054041bf6a17b4d436a
parentcdc37ca3d04b165a5e60aa1c29754385bbdeef90
vhost: validate untrusted memory regions number field

Check if memory.nregions is valid right away.  This eliminates the
possibility of bugs when memory.nregions is used later on in
vhost_user_set_mem_table().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c