we probably just need:
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -831,8 +831,10 @@ static int tun_attach(struct tun_struct *tun,
struct file *file,
/* Setup XDP RX-queue info, for new tfile getting attached */
err = xdp_rxq_info_reg(&tfile->xdp_rxq,
tun->dev, tfile->queue_index);
- if (err < 0)
+ if (err < 0) {
+ ptr_ring_cleanup(&tfile->tx_ring, NULL);
goto out;
+ }
will check it for sure.