hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/fs/file.c
....@@ -429,6 +429,7 @@
429429 if (set & 1) {
430430 struct file * file = xchg(&fdt->fd[i], NULL);
431431 if (file) {
432
+ uninstall_inband_fd(i, file, files);
432433 filp_close(file, files);
433434 cond_resched();
434435 }
....@@ -646,6 +647,7 @@
646647 fdt = files_fdtable(files);
647648 BUG_ON(fdt->fd[fd] != NULL);
648649 rcu_assign_pointer(fdt->fd[fd], file);
650
+ install_inband_fd(fd, file, files);
649651 spin_unlock(&files->file_lock);
650652 return;
651653 }
....@@ -654,6 +656,7 @@
654656 fdt = rcu_dereference_sched(files->fdt);
655657 BUG_ON(fdt->fd[fd] != NULL);
656658 rcu_assign_pointer(fdt->fd[fd], file);
659
+ install_inband_fd(fd, file, files);
657660 rcu_read_unlock_sched();
658661 }
659662
....@@ -682,6 +685,7 @@
682685 goto out_unlock;
683686 rcu_assign_pointer(fdt->fd[fd], NULL);
684687 __put_unused_fd(files, fd);
688
+ uninstall_inband_fd(fd, file, files);
685689
686690 out_unlock:
687691 spin_unlock(&files->file_lock);
....@@ -799,6 +803,8 @@
799803 goto out_err;
800804 rcu_assign_pointer(fdt->fd[fd], NULL);
801805 __put_unused_fd(files, fd);
806
+ uninstall_inband_fd(fd, file, files);
807
+ spin_unlock(&files->file_lock);
802808 get_file(file);
803809 *res = file;
804810 return 0;
....@@ -850,6 +856,7 @@
850856 continue;
851857 rcu_assign_pointer(fdt->fd[fd], NULL);
852858 __put_unused_fd(files, fd);
859
+ uninstall_inband_fd(fd, file, files);
853860 spin_unlock(&files->file_lock);
854861 filp_close(file, files);
855862 cond_resched();
....@@ -1088,6 +1095,7 @@
10881095 __set_close_on_exec(fd, fdt);
10891096 else
10901097 __clear_close_on_exec(fd, fdt);
1098
+ replace_inband_fd(fd, file, files);
10911099 spin_unlock(&files->file_lock);
10921100
10931101 if (tofree)