diff options
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 7cd55e078794..5be11c99e18f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/poll.h> | 22 | #include <linux/poll.h> |
23 | #include <linux/file.h> | 23 | #include <linux/file.h> |
24 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include <linux/net.h> | 27 | #include <linux/net.h> |
27 | #include <linux/if_packet.h> | 28 | #include <linux/if_packet.h> |
@@ -476,8 +477,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
476 | if (r < 0) | 477 | if (r < 0) |
477 | break; | 478 | break; |
478 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 479 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
479 | if (IS_ERR(eventfp)) | 480 | if (IS_ERR(eventfp)) { |
480 | return PTR_ERR(eventfp); | 481 | r = PTR_ERR(eventfp); |
482 | break; | ||
483 | } | ||
481 | if (eventfp != vq->kick) { | 484 | if (eventfp != vq->kick) { |
482 | pollstop = filep = vq->kick; | 485 | pollstop = filep = vq->kick; |
483 | pollstart = vq->kick = eventfp; | 486 | pollstart = vq->kick = eventfp; |
@@ -489,8 +492,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
489 | if (r < 0) | 492 | if (r < 0) |
490 | break; | 493 | break; |
491 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 494 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
492 | if (IS_ERR(eventfp)) | 495 | if (IS_ERR(eventfp)) { |
493 | return PTR_ERR(eventfp); | 496 | r = PTR_ERR(eventfp); |
497 | break; | ||
498 | } | ||
494 | if (eventfp != vq->call) { | 499 | if (eventfp != vq->call) { |
495 | filep = vq->call; | 500 | filep = vq->call; |
496 | ctx = vq->call_ctx; | 501 | ctx = vq->call_ctx; |
@@ -505,8 +510,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
505 | if (r < 0) | 510 | if (r < 0) |
506 | break; | 511 | break; |
507 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 512 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
508 | if (IS_ERR(eventfp)) | 513 | if (IS_ERR(eventfp)) { |
509 | return PTR_ERR(eventfp); | 514 | r = PTR_ERR(eventfp); |
515 | break; | ||
516 | } | ||
510 | if (eventfp != vq->error) { | 517 | if (eventfp != vq->error) { |
511 | filep = vq->error; | 518 | filep = vq->error; |
512 | vq->error = eventfp; | 519 | vq->error = eventfp; |