include/linux/ref_tracker.h provides ref_tracker/ref_tracker_dir types that can be used to detect a number of bug types related to reference counters (leaks, double frees, etc) with actionable diagnostics. There may be value in integrating ref_tracker/ref_tracker_dir with debug objects. At least to detect when active ref_tracker/ref_tracker_dir are freed. Currently there is ref_tracker_dir_exit() that needs to be called manually. And there does not seem to be a function for checking freeing of active ref_tracker objects.