* check that we don't add a second list entry with the same LPI.
         */
        oldirq = xa_load(&dist->lpi_xa, intid);
-       if (oldirq) {
+       if (vgic_try_get_irq_kref(oldirq)) {
                /* Someone was faster with adding this LPI, lets use that. */
                kfree(irq);
                irq = oldirq;
 
-               /*
-                * This increases the refcount, the caller is expected to
-                * call vgic_put_irq() on the returned pointer once it's
-                * finished with the IRQ.
-                */
-               vgic_get_irq_kref(irq);
-
                goto out_unlock;
        }
 
        raw_spin_lock_irqsave(&dist->lpi_list_lock, flags);
 
        irq = __vgic_its_check_cache(dist, db, devid, eventid);
-       if (irq)
-               vgic_get_irq_kref(irq);
+       if (!vgic_try_get_irq_kref(irq))
+               irq = NULL;
 
        raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags);
 
        if (cte->irq)
                __vgic_put_lpi_locked(kvm, cte->irq);
 
+       /*
+        * The irq refcount is guaranteed to be nonzero while holding the
+        * its_lock, as the ITE (and the reference it holds) cannot be freed.
+        */
+       lockdep_assert_held(&its->its_lock);
        vgic_get_irq_kref(irq);
 
        cte->db         = db;
 
 
        /*
         * Grab a reference to the irq to reflect the fact that it is
-        * now in the ap_list.
+        * now in the ap_list. This is safe as the caller must already hold a
+        * reference on the irq.
         */
        vgic_get_irq_kref(irq);
        list_add_tail(&irq->ap_list, &vcpu->arch.vgic_cpu.ap_list_head);