Re: [PATCH] apparmor: fix double d_instantiate() in ns_mkdir_op()

From
sashiko-bot@kernel.org
Date
2026-11-09 03:35:31
Reply to
Ran Hongyun, 2026-11-09
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 <redacted>
Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109025600.2031008-1-ranhongyun1@huawei.com?part=1
Thread (2 messages) 2 messages, 2 authors, last reply 7d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help