Skip to content

Commit 986ffe6

Browse files
committed
Merge tag 'fsnotify_for_v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull fsnotify fix from Jan Kara: "A fix for fanotify to disallow creating of mount or superblock marks for kernel internal pseudo filesystems" * tag 'fsnotify_for_v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fanotify: disallow mount/sb marks on kernel internal pseudo fs
2 parents 4f6b6c2 + 69562eb commit 986ffe6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/notify/fanotify/fanotify_user.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,20 @@ static int fanotify_events_supported(struct fsnotify_group *group,
16221622
path->mnt->mnt_sb->s_type->fs_flags & FS_DISALLOW_NOTIFY_PERM)
16231623
return -EINVAL;
16241624

1625+
/*
1626+
* mount and sb marks are not allowed on kernel internal pseudo fs,
1627+
* like pipe_mnt, because that would subscribe to events on all the
1628+
* anonynous pipes in the system.
1629+
*
1630+
* SB_NOUSER covers all of the internal pseudo fs whose objects are not
1631+
* exposed to user's mount namespace, but there are other SB_KERNMOUNT
1632+
* fs, like nsfs, debugfs, for which the value of allowing sb and mount
1633+
* mark is questionable. For now we leave them alone.
1634+
*/
1635+
if (mark_type != FAN_MARK_INODE &&
1636+
path->mnt->mnt_sb->s_flags & SB_NOUSER)
1637+
return -EINVAL;
1638+
16251639
/*
16261640
* We shouldn't have allowed setting dirent events and the directory
16271641
* flags FAN_ONDIR and FAN_EVENT_ON_CHILD in mask of non-dir inode,

0 commit comments

Comments
 (0)