--- zzzz-none-000/linux-5.4.213/lib/debugobjects.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/lib/debugobjects.c 2024-05-29 11:20:02.000000000 +0000 @@ -473,6 +473,29 @@ return &obj_hash[hash]; } +/* + * debug_object_get_state(): + * returns the state of an object given an address + */ +int debug_object_get_state(void *addr) +{ + struct debug_bucket *db; + struct debug_obj *obj; + unsigned long flags; + enum debug_obj_state state = ODEBUG_STATE_NOTAVAILABLE; + + db = get_bucket((unsigned long) addr); + + raw_spin_lock_irqsave(&db->lock, flags); + obj = lookup_object(addr, db); + if (obj) + state = obj->state; + raw_spin_unlock_irqrestore(&db->lock, flags); + + return state; +} +EXPORT_SYMBOL(debug_object_get_state); + static void debug_print_object(struct debug_obj *obj, char *msg) { struct debug_obj_descr *descr = obj->descr;