[PATCH] apparmor: fix double d_instantiate() in ns_mkdir_op()
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Nov 9 03:35:30 UTC 2026
> ns_mkdir_op() drops inode_lock for simple_pin_fs() and re-acquires it
> before instantiating the dentry. A concurrent mkdir() of the same name
> can pass the VFS negative-dentry checks in that window and also reach
> d_instantiate(), tripping BUG_ON(!hlist_unhashed(&d_alias)).
>
> Re-check that the dentry is still negative after re-acquiring inode_lock
> and return -EEXIST if a concurrent mkdir() won the race.
>
> Fixes: 4ae47f33354a ("apparmor: add mkdir/rmdir interface to manage policy namespaces")
> Signed-off-by: Ran Hongyun <ranhongyun1 at huawei.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109025600.2031008-1-ranhongyun1@huawei.com?part=1
More information about the Linux-security-module-archive
mailing list