syzbot found that touch /proc/testfile causes NULL pointer dereference at tomoyo_get_local_path() because inode of the dentry is NULL. Before c59f415a7cb6, Tomoyo received pid_ns from proc's s_fs_info directly. Since proc_pid_ns() can only work with inode, using it in the tomoyo_get_local_path() was wrong. To avoid creating more functions for getting proc_ns, change the argument type of the proc_pid_ns() function. Then, Tomoyo can use the existing super_block to get pid_ns.
Showing the changes to kernel (1 of 9 files). Show all
Unified · Split
| @@ -1745,7 +1745,7 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f) · 1744 unmodified lines | |||
| 1745 | pid_t nr = -1; | 1745 | pid_t nr = -1; |
| 1746 | 1746 | ||
| 1747 | if (likely(pid_has_task(pid, PIDTYPE_PID))) { | 1747 | if (likely(pid_has_task(pid, PIDTYPE_PID))) { |
| 1748 | ns = proc_pid_ns(file_inode(m->file)); | 1748 | ns = proc_pid_ns(file_inode(m->file)->i_sb); |
| 1749 | nr = pid_nr_ns(pid, ns); | 1749 | nr = pid_nr_ns(pid, ns); |
| 1750 | } | 1750 | } |
| 1751 | 1751 | ||