BACKPORT: do_epoll_ctl(): clean the failure exits up a bit

commit 52c479697c9b73f628140dcdfcd39ea302d05482 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Issue: SEC-2677
[backport to FP2: Missing change "epoll: do not take global 'epmutex'
for simple topologies", so we don't have the full_check condition yet.]
Change-Id: I97468c95d3c22cc5f538dfcf78907aefa35a6503
(cherry picked from commit 1d90193cda629e352eecfe0d1a2cec388c73ab68)
This commit is contained in:
Al Viro
2021-10-10 23:46:48 +02:00
committed by Francescodario Cuzzocrea
parent 41f9967c1f
commit 51554778ff
+3 -3
View File
@@ -1772,7 +1772,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
if (is_file_epoll(tf.file)) { if (is_file_epoll(tf.file)) {
error = -ELOOP; error = -ELOOP;
if (ep_loop_check(ep, tf.file) != 0) { if (ep_loop_check(ep, tf.file) != 0) {
clear_tfile_check_list();
goto error_tgt_fput; goto error_tgt_fput;
} }
} else { } else {
@@ -1798,7 +1797,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
error = ep_insert(ep, &epds, tf.file, fd); error = ep_insert(ep, &epds, tf.file, fd);
} else } else
error = -EEXIST; error = -EEXIST;
clear_tfile_check_list();
break; break;
case EPOLL_CTL_DEL: case EPOLL_CTL_DEL:
if (epi) if (epi)
@@ -1817,8 +1815,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
mutex_unlock(&ep->mtx); mutex_unlock(&ep->mtx);
error_tgt_fput: error_tgt_fput:
if (did_lock_epmutex) if (did_lock_epmutex) {
clear_tfile_check_list();
mutex_unlock(&epmutex); mutex_unlock(&epmutex);
}
fdput(tf); fdput(tf);
error_fput: error_fput: