File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -377,10 +377,11 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
377
377
struct eventfd_ctx * eventfd = NULL , * resamplefd = NULL ;
378
378
struct mshv_irqfd * irqfd , * tmp ;
379
379
unsigned int events ;
380
- struct fd f ;
381
380
int ret ;
382
381
int idx ;
383
382
383
+ CLASS (fd , f )(args -> fd );
384
+
384
385
irqfd = kzalloc (sizeof (* irqfd ), GFP_KERNEL );
385
386
if (!irqfd )
386
387
return - ENOMEM ;
@@ -390,8 +391,7 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
390
391
INIT_WORK (& irqfd -> irqfd_shutdown , mshv_irqfd_shutdown );
391
392
seqcount_spinlock_init (& irqfd -> irqfd_irqe_sc , & pt -> pt_irqfds_lock );
392
393
393
- f = fdget (args -> fd );
394
- if (!fd_file (f )) {
394
+ if (fd_empty (f )) {
395
395
ret = - EBADF ;
396
396
goto out ;
397
397
}
@@ -496,12 +496,6 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
496
496
mshv_assert_irq_slow (irqfd );
497
497
498
498
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
-
505
499
return 0 ;
506
500
507
501
fail :
@@ -514,8 +508,6 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
514
508
if (eventfd && !IS_ERR (eventfd ))
515
509
eventfd_ctx_put (eventfd );
516
510
517
- fdput (f );
518
-
519
511
out :
520
512
kfree (irqfd );
521
513
return ret ;
You can’t perform that action at this time.
0 commit comments