Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f8d4f44d
Commit
f8d4f44d
authored
Sep 09, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epoll: do not insert into poll queues until all sanity checks are done
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
77f4689d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
fs/eventpoll.c
fs/eventpoll.c
+18
-19
No files found.
fs/eventpoll.c
View file @
f8d4f44d
...
...
@@ -1522,6 +1522,22 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
RCU_INIT_POINTER
(
epi
->
ws
,
NULL
);
}
/* Add the current item to the list of active epoll hook for this file */
spin_lock
(
&
tfile
->
f_lock
);
list_add_tail_rcu
(
&
epi
->
fllink
,
&
tfile
->
f_ep_links
);
spin_unlock
(
&
tfile
->
f_lock
);
/*
* Add the current item to the RB tree. All RB tree operations are
* protected by "mtx", and ep_insert() is called with "mtx" held.
*/
ep_rbtree_insert
(
ep
,
epi
);
/* now check if we've created too many backpaths */
error
=
-
EINVAL
;
if
(
full_check
&&
reverse_path_check
())
goto
error_remove_epi
;
/* Initialize the poll table using the queue callback */
epq
.
epi
=
epi
;
init_poll_funcptr
(
&
epq
.
pt
,
ep_ptable_queue_proc
);
...
...
@@ -1544,22 +1560,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
if
(
epi
->
nwait
<
0
)
goto
error_unregister
;
/* Add the current item to the list of active epoll hook for this file */
spin_lock
(
&
tfile
->
f_lock
);
list_add_tail_rcu
(
&
epi
->
fllink
,
&
tfile
->
f_ep_links
);
spin_unlock
(
&
tfile
->
f_lock
);
/*
* Add the current item to the RB tree. All RB tree operations are
* protected by "mtx", and ep_insert() is called with "mtx" held.
*/
ep_rbtree_insert
(
ep
,
epi
);
/* now check if we've created too many backpaths */
error
=
-
EINVAL
;
if
(
full_check
&&
reverse_path_check
())
goto
error_remove_epi
;
/* We have to drop the new item inside our item list to keep track of it */
write_lock_irq
(
&
ep
->
lock
);
...
...
@@ -1588,6 +1588,8 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
return
0
;
error_unregister:
ep_unregister_pollwait
(
ep
,
epi
);
error_remove_epi:
spin_lock
(
&
tfile
->
f_lock
);
list_del_rcu
(
&
epi
->
fllink
);
...
...
@@ -1595,9 +1597,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
rb_erase_cached
(
&
epi
->
rbn
,
&
ep
->
rbr
);
error_unregister:
ep_unregister_pollwait
(
ep
,
epi
);
/*
* We need to do this because an event could have been arrived on some
* allocated wait queue. Note that we don't care about the ep->ovflist
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment