Skip to content

Commit d5084ff

Browse files
committed
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()
2 parents 27bb0b1 + ee12595 commit d5084ff

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/notify/fanotify/fanotify_user.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,16 +701,16 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
701701
if (fanotify_is_perm_event(event->mask))
702702
FANOTIFY_PERM(event)->fd = fd;
703703

704-
if (f)
705-
fd_install(fd, f);
706-
707704
if (info_mode) {
708705
ret = copy_info_records_to_user(event, info, info_mode, pidfd,
709706
buf, count);
710707
if (ret < 0)
711708
goto out_close_fd;
712709
}
713710

711+
if (f)
712+
fd_install(fd, f);
713+
714714
return metadata.event_len;
715715

716716
out_close_fd:

0 commit comments

Comments
 (0)