Skip to content

Commit

Permalink
Merge tag 'fsnotify_for_v5.17-rc3' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/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()
  • Loading branch information
Linus Torvalds committed Feb 2, 2022
2 parents 27bb0b1 + ee12595 commit d5084ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/notify/fanotify/fanotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,16 +701,16 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
if (fanotify_is_perm_event(event->mask))
FANOTIFY_PERM(event)->fd = fd;

if (f)
fd_install(fd, f);

if (info_mode) {
ret = copy_info_records_to_user(event, info, info_mode, pidfd,
buf, count);
if (ret < 0)
goto out_close_fd;
}

if (f)
fd_install(fd, f);

return metadata.event_len;

out_close_fd:
Expand Down

0 comments on commit d5084ff

Please sign in to comment.