[PATCH 6.7 377/641] class: fix use-after-free in class_register()