virtio-serial: Make read and write methods report failure

The read and write methods return successfully even if the virtio device
is closed (virtiodev is 0) and it is not able to send or receive any
characters.

Make the read and write methods return 0 to indicate they did not
succeed in this case.

This also fixes an invalid stack access in the read method.

Fixes: 8174acd ("virtio-serial: Close device completely")
Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
1 file changed