forked from Minki/linux
9p-trans_fd: don't do fs segment mangling in p9_fd_poll()
p9_fd_poll() is never called with user pointers and f_op->poll() doesn't expect its arguments to be from userland. There's no need to set kernel ds before calling f_op->poll() from p9_fd_poll(). Remove it. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
parent
571ffeafff
commit
ec3c68f232
@ -1344,7 +1344,6 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
|
|||||||
{
|
{
|
||||||
int ret, n;
|
int ret, n;
|
||||||
struct p9_trans_fd *ts = NULL;
|
struct p9_trans_fd *ts = NULL;
|
||||||
mm_segment_t oldfs;
|
|
||||||
|
|
||||||
if (trans && trans->status == Connected)
|
if (trans && trans->status == Connected)
|
||||||
ts = trans->priv;
|
ts = trans->priv;
|
||||||
@ -1358,24 +1357,17 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
|
|||||||
if (!ts->wr->f_op || !ts->wr->f_op->poll)
|
if (!ts->wr->f_op || !ts->wr->f_op->poll)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
oldfs = get_fs();
|
|
||||||
set_fs(get_ds());
|
|
||||||
|
|
||||||
ret = ts->rd->f_op->poll(ts->rd, pt);
|
ret = ts->rd->f_op->poll(ts->rd, pt);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
return ret;
|
||||||
|
|
||||||
if (ts->rd != ts->wr) {
|
if (ts->rd != ts->wr) {
|
||||||
n = ts->wr->f_op->poll(ts->wr, pt);
|
n = ts->wr->f_op->poll(ts->wr, pt);
|
||||||
if (n < 0) {
|
if (n < 0)
|
||||||
ret = n;
|
return n;
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
ret = (ret & ~POLLOUT) | (n & ~POLLIN);
|
ret = (ret & ~POLLOUT) | (n & ~POLLIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
set_fs(oldfs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user