Skip to content

Commit af98441

Browse files
committed
Merge branch 'vhost' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
2 parents 37b7ef7 + 535297a commit af98441

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

drivers/vhost/net.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void handle_tx(struct vhost_net *net)
125125
mutex_lock(&vq->mutex);
126126
vhost_disable_notify(vq);
127127

128-
if (wmem < sock->sk->sk_sndbuf * 2)
128+
if (wmem < sock->sk->sk_sndbuf / 2)
129129
tx_poll_stop(net);
130130
hdr_size = vq->hdr_size;
131131

@@ -508,12 +508,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
508508
/* Verify that ring has been setup correctly. */
509509
if (!vhost_vq_access_ok(vq)) {
510510
r = -EFAULT;
511-
goto err;
511+
goto err_vq;
512512
}
513513
sock = get_socket(fd);
514514
if (IS_ERR(sock)) {
515515
r = PTR_ERR(sock);
516-
goto err;
516+
goto err_vq;
517517
}
518518

519519
/* start polling new socket */
@@ -524,12 +524,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
524524
vhost_net_disable_vq(n, vq);
525525
rcu_assign_pointer(vq->private_data, sock);
526526
vhost_net_enable_vq(n, vq);
527-
mutex_unlock(&vq->mutex);
528527
done:
529528
if (oldsock) {
530529
vhost_net_flush_vq(n, index);
531530
fput(oldsock->file);
532531
}
532+
533+
err_vq:
534+
mutex_unlock(&vq->mutex);
533535
err:
534536
mutex_unlock(&n->dev.mutex);
535537
return r;

drivers/vhost/vhost.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
476476
if (r < 0)
477477
break;
478478
eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
479-
if (IS_ERR(eventfp))
480-
return PTR_ERR(eventfp);
479+
if (IS_ERR(eventfp)) {
480+
r = PTR_ERR(eventfp);
481+
break;
482+
}
481483
if (eventfp != vq->kick) {
482484
pollstop = filep = vq->kick;
483485
pollstart = vq->kick = eventfp;
@@ -489,8 +491,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
489491
if (r < 0)
490492
break;
491493
eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
492-
if (IS_ERR(eventfp))
493-
return PTR_ERR(eventfp);
494+
if (IS_ERR(eventfp)) {
495+
r = PTR_ERR(eventfp);
496+
break;
497+
}
494498
if (eventfp != vq->call) {
495499
filep = vq->call;
496500
ctx = vq->call_ctx;
@@ -505,8 +509,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
505509
if (r < 0)
506510
break;
507511
eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
508-
if (IS_ERR(eventfp))
509-
return PTR_ERR(eventfp);
512+
if (IS_ERR(eventfp)) {
513+
r = PTR_ERR(eventfp);
514+
break;
515+
}
510516
if (eventfp != vq->error) {
511517
filep = vq->error;
512518
vq->error = eventfp;

0 commit comments

Comments
 (0)