Skip to content
Commit da35ba33 authored by Yunjian Wang's avatar Yunjian Wang Committed by Greg Kroah-Hartman
Browse files

vhost_net: fix ubuf refcount incorrectly when sendmsg fails



[ Upstream commit 01e31bea ]

Currently the vhost_zerocopy_callback() maybe be called to decrease
the refcount when sendmsg fails in tun. The error handling in vhost
handle_tx_zerocopy() will try to decrease the same refcount again.
This is wrong. To fix this issue, we only call vhost_net_ubuf_put()
when vq->heads[nvq->desc].len == VHOST_DMA_IN_PROGRESS.

Fixes: bab632d6 ("vhost: vhost TX zero-copy support")
Signed-off-by: default avatarYunjian Wang <wangyunjian@huawei.com>
Acked-by: default avatarWillem de Bruijn <willemb@google.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/1609207308-20544-1-git-send-email-wangyunjian@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 96d37173
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment