Re: [PATCH -next -v4 02/17] LSM: pass struct path to the inode_setsecctx hook

From: Cai Xinchen

Date: Wed Nov 18 2026 - 22:46:40 EST


o, you are right, dentry is borned *self-parented*, and d_alloc()/d_alloc_parallel allocate
from parent->d_sb, __d_move only re-parent withon on sb. So dget_parent() cannot
leave the sb.

On 11/18/2026 5:35 PM, Christian Brauner wrote:
On Wed, Nov 18, 2026 at 04:59:29PM +0800, Cai Xinchen wrote:
There are two places that violate (1), both introduced by this series of
patches in ksmbd:

smb2_parent_compressed() and smb_inherit_dacl() pair the directory entry
returned by dget_parent()

with path->mnt, and problems arise once that directory entry becomes the
root of its mount point.
No, (1) holds there. dget_parent() never leaves the superblock so the
parent has the same ->d_sb as path->dentry.

What happens at the root of a mount is that the parent isn't below
path->mnt->mnt_root anymore. That's a different property and struct path
doesn't guarantee that (open_by_handle_at(), nfsd with
no_subtree_check). So there's nothing to fix for (1) in those two.