Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota, ext2, isofs and udf fixes from Jan Kara: - two small quota error handling fixes - two isofs fixes for architectures with signed char - several udf block number overflow and signedness fixes - ext2 rework of mount option handling to avoid GFP_KERNEL allocation with spinlock held - ... it also contains a patch to implement auditing of responses to fanotify permission events. That should have been in the fanotify pull request but I mistakenly merged that patch into a wrong branch and noticed only now at which point I don't think it's worth rebasing and redoing. * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: quota: be aware of error from dquot_initialize quota: fix potential infinite loop isofs: use unsigned char types consistently isofs: fix timestamps beyond 2027 udf: Fix some sign-conversion warnings udf: Fix signed/unsigned format specifiers udf: Fix 64-bit sign extension issues affecting blocks > 0x7FFFFFFF udf: Remove some outdate references from documentation udf: Avoid overflow when session starts at large offset ext2: Fix possible sleep in atomic during mount option parsing ext2: Parse mount options into a dedicated structure audit: Record fanotify access control decisions
This commit is contained in:
@@ -179,7 +179,7 @@ static int process_access_response(struct fsnotify_group *group,
|
||||
* userspace can send a valid response or we will clean it up after the
|
||||
* timeout
|
||||
*/
|
||||
switch (response) {
|
||||
switch (response & ~FAN_AUDIT) {
|
||||
case FAN_ALLOW:
|
||||
case FAN_DENY:
|
||||
break;
|
||||
@@ -190,6 +190,9 @@ static int process_access_response(struct fsnotify_group *group,
|
||||
if (fd < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if ((response & FAN_AUDIT) && !group->fanotify_data.audit)
|
||||
return -EINVAL;
|
||||
|
||||
event = dequeue_event(group, fd);
|
||||
if (!event)
|
||||
return -ENOENT;
|
||||
@@ -713,7 +716,11 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
#ifdef CONFIG_AUDITSYSCALL
|
||||
if (flags & ~(FAN_ALL_INIT_FLAGS | FAN_ENABLE_AUDIT))
|
||||
#else
|
||||
if (flags & ~FAN_ALL_INIT_FLAGS)
|
||||
#endif
|
||||
return -EINVAL;
|
||||
|
||||
if (event_f_flags & ~FANOTIFY_INIT_ALL_EVENT_F_BITS)
|
||||
@@ -795,6 +802,13 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
|
||||
group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS;
|
||||
}
|
||||
|
||||
if (flags & FAN_ENABLE_AUDIT) {
|
||||
fd = -EPERM;
|
||||
if (!capable(CAP_AUDIT_WRITE))
|
||||
goto out_destroy_group;
|
||||
group->fanotify_data.audit = true;
|
||||
}
|
||||
|
||||
fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
|
||||
if (fd < 0)
|
||||
goto out_destroy_group;
|
||||
|
Reference in New Issue
Block a user