summaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2012-05-02 05:42:23 +0200
committerMichael S. Tsirkin <mst@redhat.com>2012-05-02 17:22:22 +0200
commitc460f0573941cb28dc7f35595679c3508f0ce41f (patch)
tree9d25dc66fdc5030ce551c6d2393ee1c23932f4b3 /drivers/vhost
parentmacvtap: zerocopy: validate vectors before building skb (diff)
downloadlinux-c460f0573941cb28dc7f35595679c3508f0ce41f.tar.xz
linux-c460f0573941cb28dc7f35595679c3508f0ce41f.zip
vhost_net: zerocopy: fix possible NULL pointer dereference of vq->bufs
When we want to disable vhost_net backend while there's a tx work, a possible NULL pointer defernece may happen we we try to deference the vq->bufs after vhost_net_set_backend() assign a NULL to it. As suggested by Michael, fix this by checking the vq->bufs instead of vhost_sock_zcopy(). Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 1f21d2a1e528..35abe9019ba7 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -166,7 +166,7 @@ static void handle_tx(struct vhost_net *net)
if (wmem < sock->sk->sk_sndbuf / 2)
tx_poll_stop(net);
hdr_size = vq->vhost_hlen;
- zcopy = vhost_sock_zcopy(sock);
+ zcopy = vq->ubufs;
for (;;) {
/* Release DMAs done buffers first */