aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index c16d00e53264..13c65dd2d37d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1222,9 +1222,6 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
1222 struct fuse_in *in; 1222 struct fuse_in *in;
1223 unsigned reqsize; 1223 unsigned reqsize;
1224 1224
1225 if (task_active_pid_ns(current) != fc->pid_ns)
1226 return -EIO;
1227
1228 restart: 1225 restart:
1229 spin_lock(&fiq->waitq.lock); 1226 spin_lock(&fiq->waitq.lock);
1230 err = -EAGAIN; 1227 err = -EAGAIN;
@@ -1262,6 +1259,13 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
1262 1259
1263 in = &req->in; 1260 in = &req->in;
1264 reqsize = in->h.len; 1261 reqsize = in->h.len;
1262
1263 if (task_active_pid_ns(current) != fc->pid_ns) {
1264 rcu_read_lock();
1265 in->h.pid = pid_vnr(find_pid_ns(in->h.pid, fc->pid_ns));
1266 rcu_read_unlock();
1267 }
1268
1265 /* If request is too large, reply with an error and restart the read */ 1269 /* If request is too large, reply with an error and restart the read */
1266 if (nbytes < reqsize) { 1270 if (nbytes < reqsize) {
1267 req->out.h.error = -EIO; 1271 req->out.h.error = -EIO;
@@ -1823,9 +1827,6 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
1823 struct fuse_req *req; 1827 struct fuse_req *req;
1824 struct fuse_out_header oh; 1828 struct fuse_out_header oh;
1825 1829
1826 if (task_active_pid_ns(current) != fc->pid_ns)
1827 return -EIO;
1828
1829 if (nbytes < sizeof(struct fuse_out_header)) 1830 if (nbytes < sizeof(struct fuse_out_header))
1830 return -EINVAL; 1831 return -EINVAL;
1831 1832