[RFC PATCH 1/6] fs/9p: Add ability to identify inode by path for .L

Al Viro viro at zeniv.linux.org.uk
Sat Jul 5 00:19:13 UTC 2025


On Sun, Apr 06, 2025 at 09:43:02PM +0100, Tingmao Wang wrote:

> +struct v9fs_ino_path *make_ino_path(struct dentry *dentry)
> +{
> +	struct v9fs_ino_path *path;
> +	size_t path_components = 0;
> +	struct dentry *curr = dentry;
> +	ssize_t i;
> +
> +	lockdep_assert_held_read(&v9fs_dentry2v9ses(dentry)->rename_sem);
> +
> +	rcu_read_lock();
> +
> +    /* Don't include the root dentry */
> +	while (curr->d_parent != curr) {
> +		path_components++;
> +		curr = curr->d_parent;
> +	}
> +	if (WARN_ON(path_components > SSIZE_MAX)) {
> +		rcu_read_unlock();
> +		return NULL;
> +	}
> +
> +	path = kmalloc(struct_size(path, names, path_components),
> +		       GFP_KERNEL);

Blocking allocation under rcu_read_lock().



More information about the Linux-security-module-archive mailing list