Re: [PATCH v2 1/5] tracefs: Reset permissions on remount if permissions are options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 02 May 2024 11:15:48 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> +/*
> + * On a remount of tracefs, if UID or GID options are set, then
> + * the mount point inode permissions should be used.
> + * Reset the saved permission flags appropriately.
> + */
> +void eventfs_remount(struct tracefs_inode *ti, bool update_uid, bool update_gid)
> +{
> +	struct eventfs_inode *ei = ti->private;

And I just realized there's a race here too :-p

I need to set ti->private = NULL before freeing the ei, and probably free
the ei via RCU.

-- Steve


> +
> +	if (!ei)
> +		return;
> +
> +	if (update_uid)
> +		ei->attr.mode &= ~EVENTFS_SAVE_UID;
> +
> +	if (update_gid)
> +		ei->attr.mode &= ~EVENTFS_SAVE_GID;
> +
> +	if (!ei->entry_attrs)
> +		return;
> +
> +	for (int i = 0; i < ei->nr_entries; i++) {
> +		if (update_uid)
> +			ei->entry_attrs[i].mode &= ~EVENTFS_SAVE_UID;
> +		if (update_gid)
> +			ei->entry_attrs[i].mode &= ~EVENTFS_SAVE_GID;
> +	}
> +}
> +




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux