Skip to content

Commit 953e117

Browse files
committed
Merge tag 'pull-fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull CLASS(fd) update from Al Viro: "A missing bit of commit 66635b0 ("assorted variants of irqfd setup: convert to CLASS(fd)") from a year ago. mshv_eventfd would've been covered by that, but it had forked slightly before that series and got merged into mainline later" * tag 'pull-fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: mshv_eventfd: convert to CLASS(fd)
2 parents 815d3c1 + ce23f29 commit 953e117

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/hv/mshv_eventfd.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,11 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
377377
struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL;
378378
struct mshv_irqfd *irqfd, *tmp;
379379
unsigned int events;
380-
struct fd f;
381380
int ret;
382381
int idx;
383382

383+
CLASS(fd, f)(args->fd);
384+
384385
irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
385386
if (!irqfd)
386387
return -ENOMEM;
@@ -390,8 +391,7 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
390391
INIT_WORK(&irqfd->irqfd_shutdown, mshv_irqfd_shutdown);
391392
seqcount_spinlock_init(&irqfd->irqfd_irqe_sc, &pt->pt_irqfds_lock);
392393

393-
f = fdget(args->fd);
394-
if (!fd_file(f)) {
394+
if (fd_empty(f)) {
395395
ret = -EBADF;
396396
goto out;
397397
}
@@ -496,12 +496,6 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
496496
mshv_assert_irq_slow(irqfd);
497497

498498
srcu_read_unlock(&pt->pt_irq_srcu, idx);
499-
/*
500-
* do not drop the file until the irqfd is fully initialized, otherwise
501-
* we might race against the POLLHUP
502-
*/
503-
fdput(f);
504-
505499
return 0;
506500

507501
fail:
@@ -514,8 +508,6 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
514508
if (eventfd && !IS_ERR(eventfd))
515509
eventfd_ctx_put(eventfd);
516510

517-
fdput(f);
518-
519511
out:
520512
kfree(irqfd);
521513
return ret;

0 commit comments

Comments
 (0)