Commit d5084ffb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fsnotify_for_v5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fanotify fix from Jan Kara:
 "Fix stale file descriptor in copy_event_to_user"

* tag 'fsnotify_for_v5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fanotify: Fix stale file descriptor in copy_event_to_user()
parents 27bb0b18 ee125951
...@@ -701,9 +701,6 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, ...@@ -701,9 +701,6 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
if (fanotify_is_perm_event(event->mask)) if (fanotify_is_perm_event(event->mask))
FANOTIFY_PERM(event)->fd = fd; FANOTIFY_PERM(event)->fd = fd;
if (f)
fd_install(fd, f);
if (info_mode) { if (info_mode) {
ret = copy_info_records_to_user(event, info, info_mode, pidfd, ret = copy_info_records_to_user(event, info, info_mode, pidfd,
buf, count); buf, count);
...@@ -711,6 +708,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, ...@@ -711,6 +708,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
goto out_close_fd; goto out_close_fd;
} }
if (f)
fd_install(fd, f);
return metadata.event_len; return metadata.event_len;
out_close_fd: out_close_fd:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment