Skip to content

Commit 5d540e4

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: fix post open error handling
Closing a queue doesn't guarantee that all associated page pools are terminated right away, let the refcounting do the work instead of releasing the zcrx ctx directly. Cc: stable@vger.kernel.org Fixes: e0793de ("io_uring/zcrx: set pp memory provider for an rx queue") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent a983aae commit 5d540e4

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

io_uring/zcrx.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,17 +515,15 @@ static void io_close_queue(struct io_zcrx_ifq *ifq)
515515
.mp_priv = ifq,
516516
};
517517

518-
if (ifq->if_rxq == -1)
519-
return;
520-
521518
scoped_guard(mutex, &ifq->pp_lock) {
522519
netdev = ifq->netdev;
523520
netdev_tracker = ifq->netdev_tracker;
524521
ifq->netdev = NULL;
525522
}
526523

527524
if (netdev) {
528-
net_mp_close_rxq(netdev, ifq->if_rxq, &p);
525+
if (ifq->if_rxq != -1)
526+
net_mp_close_rxq(netdev, ifq->if_rxq, &p);
529527
netdev_put(netdev, &netdev_tracker);
530528
}
531529
ifq->if_rxq = -1;
@@ -833,13 +831,12 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
833831
}
834832
return 0;
835833
netdev_put_unlock:
836-
netdev_put(ifq->netdev, &ifq->netdev_tracker);
837834
netdev_unlock(ifq->netdev);
838835
err:
839836
scoped_guard(mutex, &ctx->mmap_lock)
840837
xa_erase(&ctx->zcrx_ctxs, id);
841838
ifq_free:
842-
io_zcrx_ifq_free(ifq);
839+
zcrx_unregister(ifq);
843840
return ret;
844841
}
845842

0 commit comments

Comments
 (0)