mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
eventfs: Check for NULL ef in eventfs_set_attr()
The top level events directory dentry does not have a d_fsdata set to a
eventfs_file pointer. This dentry is still passed to eventfs_set_attr().
It can not assume that the d_fsdata is set. Check for that.
Link: https://lore.kernel.org/all/20231112104158.6638-1-milian.wolff@kdab.com/
Fixes: 9aaee3eebc
("eventfs: Save ownership and mode")
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dc43609d12
commit
d8f492a059
1 changed files with 2 additions and 2 deletions
|
@ -113,14 +113,14 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
|
|
||||||
mutex_lock(&eventfs_mutex);
|
mutex_lock(&eventfs_mutex);
|
||||||
ef = dentry->d_fsdata;
|
ef = dentry->d_fsdata;
|
||||||
if (ef->is_freed) {
|
if (ef && ef->is_freed) {
|
||||||
/* Do not allow changes if the event is about to be removed. */
|
/* Do not allow changes if the event is about to be removed. */
|
||||||
mutex_unlock(&eventfs_mutex);
|
mutex_unlock(&eventfs_mutex);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = simple_setattr(idmap, dentry, iattr);
|
ret = simple_setattr(idmap, dentry, iattr);
|
||||||
if (!ret)
|
if (!ret && ef)
|
||||||
update_attr(ef, iattr);
|
update_attr(ef, iattr);
|
||||||
mutex_unlock(&eventfs_mutex);
|
mutex_unlock(&eventfs_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue