Skip to content

Commit b82c6f5

Browse files
josefbacikjankara
authored andcommitted
fanotify: don't skip extra event info if no info_mode is set
Previously we would only include optional information if you requested it via an FAN_ flag at fanotify_init time (FAN_REPORT_FID for example). However this isn't necessary as the event length is encoded in the metadata, and if the user doesn't want to consume the information they don't have to. With the PRE_ACCESS events we will always generate range information, so drop this check in order to allow this extra information to be exported without needing to have another flag. Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/afcbc4e4139dee076ef1757918b037d3b48c3edb.1731684329.git.josef@toxicpanda.com
1 parent 318652e commit b82c6f5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

fs/notify/fanotify/fanotify_user.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode,
158158
int fh_len;
159159
int dot_len = 0;
160160

161-
if (!info_mode)
162-
return event_len;
163-
164161
if (fanotify_is_error_event(event->mask))
165162
event_len += FANOTIFY_ERROR_INFO_LEN;
166163

@@ -754,12 +751,10 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
754751
buf += FAN_EVENT_METADATA_LEN;
755752
count -= FAN_EVENT_METADATA_LEN;
756753

757-
if (info_mode) {
758-
ret = copy_info_records_to_user(event, info, info_mode, pidfd,
759-
buf, count);
760-
if (ret < 0)
761-
goto out_close_fd;
762-
}
754+
ret = copy_info_records_to_user(event, info, info_mode, pidfd,
755+
buf, count);
756+
if (ret < 0)
757+
goto out_close_fd;
763758

764759
if (f)
765760
fd_install(fd, f);

0 commit comments

Comments
 (0)