On Thu, Apr 24, 2025 at 05:22:48PM +0800, Baolu Lu wrote:
That's not the kernel pattern, you are supposed to unwind correctly inHmm, I've considered this. My thought was that xa_store() failure only-err_clear:no_free_ptr() should be used before successful return. Here xa_store()
- ida_free(&iommu->domain_ida, info->did);
-err_unlock:
- kfree(info);
- return ret;
+ return xa_err(xa_store(&domain->iommu_array, iommu->seq_id,
+ no_free_ptr(info), GFP_KERNEL));
}
could return error but at that point no auto free as no_free_ptr() already
changes 'info' to NULL. then memory leak.
occurs due to the system running out of memory, and the Linux kernel
can't recover from it. In that case, the system is already broken;
hence, handling the failure case here doesn't make things better.
those failures
I think you should not use cleanup.h for something complicated like
this..