clean reverse_path_check_proc() a bit

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2020-09-26 15:54:05 -04:00
parent 0c320f776e
commit d16312a469

View File

@ -1317,23 +1317,15 @@ static int reverse_path_check_proc(struct file *file, int depth)
/* CTL_DEL can remove links here, but that can't increase our count */ /* CTL_DEL can remove links here, but that can't increase our count */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(epi, &file->f_ep_links, fllink) { list_for_each_entry_rcu(epi, &file->f_ep_links, fllink) {
struct file *child_file = epi->ep->file; struct file *recepient = epi->ep->file;
if (is_file_epoll(child_file)) { if (WARN_ON(!is_file_epoll(recepient)))
if (list_empty(&child_file->f_ep_links)) { continue;
if (path_count_inc(depth)) { if (list_empty(&recepient->f_ep_links))
error = -1; error = path_count_inc(depth);
break; else
} error = reverse_path_check_proc(recepient, depth + 1);
} else { if (error != 0)
error = reverse_path_check_proc(child_file, break;
depth + 1);
}
if (error != 0)
break;
} else {
printk(KERN_ERR "reverse_path_check_proc: "
"file is not an ep!\n");
}
} }
rcu_read_unlock(); rcu_read_unlock();
return error; return error;