vhost: buffers leak and interface disable upon vring descriptor out of mmap 75/6775/2
authorSteven <sluong@cisco.com>
Fri, 19 May 2017 04:22:00 +0000 (21:22 -0700)
committerJohn Lo <loj@cisco.com>
Sat, 20 May 2017 17:43:12 +0000 (17:43 +0000)
commit95827e430762a2858f4e56e1248a4a93d629a938
tree946868f28a62662866903648cc4c73e0da8ec19e
parentc442e6197399f65b02a9c97fe040af7f442bdea9
vhost: buffers leak and interface disable upon vring descriptor out of mmap

When processing a vring descriptor which is outside of mmap, we disable
the interface and spit a message to shut/no shut the interface. This is
not practical as application using vhost cannot constantly checking the
logs and do the recovery. The proposed fix is to log an error, like
other errors that we encounter.

The other bug is buffer leak in the function rewind. At the end of the
while loop when b_current != b_head, we still have to give back 1 more
buffer or add 1 to rx_buffers_len.

Change-Id: I68c0b24f070e644cd8878f42272a7b518f14393f
Signed-off-by: Steven <sluong@cisco.com>
src/vnet/devices/virtio/vhost-user.c