• Jason Wang's avatar
    vhost_net: handle polling errors when setting backend · 2b8b328b
    Jason Wang authored
    Currently, the polling errors were ignored, which can lead following issues:
    
    - vhost remove itself unconditionally from waitqueue when stopping the poll,
      this may crash the kernel since the previous attempt of starting may fail to
      add itself to the waitqueue
    - userspace may think the backend were successfully set even when the polling
      failed.
    
    Solve this by:
    
    - check poll->wqh before trying to remove from waitqueue
    - report polling errors in vhost_poll_start(), tx_poll_start(), the return value
      will be checked and returned when userspace want to set the backend
    
    After this fix, there still could be a polling failure after backend is set, it
    will addressed by the next patch.
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2b8b328b
vhost.h 6.72 KB