--- x/include/linux/xattr.h +++ a/include/linux/xattr.h @@ -106,8 +106,13 @@ static inline void simple_xattrs_init(st static inline void simple_xattrs_free(struct simple_xattrs *xattrs) { struct simple_xattr *xattr, *node; + LIST_HEAD(head); - list_for_each_entry_safe(xattr, node, &xattrs->head, list) { + spin_lock(&xattrs->lock); + list_splice_init(&xattrs->head, &head); + spin_unlock(&xattrs->lock); + + list_for_each_entry_safe(xattr, node, &head, list) { kfree(xattr->name); kvfree(xattr); }