--- y/security/integrity/iint.c +++ i/security/integrity/iint.c @@ -85,6 +85,17 @@ static void iint_free(struct integrity_i kmem_cache_free(iint_cache, iint); } +static void iint_annotate_mutex_key(struct integrity_iint_cache *iint, struct inode *inode) +{ +#ifdef CONFIG_LOCKDEP + static struct lock_class_key iint_mutex_key[FILESYSTEM_MAX_STACK_DEPTH]; + + int depth = inode->i_sb->s_stack_depth; + + lockdep_set_class(&iint->mutex, &iint_mutex_key[depth]); +#endif +} + /** * integrity_inode_get - find or allocate an iint associated with an inode * @inode: pointer to the inode @@ -114,6 +125,8 @@ struct integrity_iint_cache *integrity_i if (!iint) return NULL; + iint_annotate_mutex_key(iint, inode); + write_lock(&integrity_iint_lock); p = &integrity_iint_tree.rb_node;