diff options
-rw-r--r-- | fs/splice.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/splice.c b/fs/splice.c index 8f1dfaecc8f0..0d92dabcc576 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1316,12 +1316,11 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, | |||
1316 | * location, so checking ->i_pipe is not enough to verify that this is a | 1316 | * location, so checking ->i_pipe is not enough to verify that this is a |
1317 | * pipe. | 1317 | * pipe. |
1318 | */ | 1318 | */ |
1319 | static inline struct pipe_inode_info *pipe_info(struct inode *inode) | 1319 | static inline struct pipe_inode_info *get_pipe_info(struct file *file) |
1320 | { | 1320 | { |
1321 | if (S_ISFIFO(inode->i_mode)) | 1321 | struct inode *i = file->f_path.dentry->d_inode; |
1322 | return inode->i_pipe; | ||
1323 | 1322 | ||
1324 | return NULL; | 1323 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; |
1325 | } | 1324 | } |
1326 | 1325 | ||
1327 | /* | 1326 | /* |
@@ -1336,8 +1335,8 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1336 | loff_t offset, *off; | 1335 | loff_t offset, *off; |
1337 | long ret; | 1336 | long ret; |
1338 | 1337 | ||
1339 | ipipe = pipe_info(in->f_path.dentry->d_inode); | 1338 | ipipe = get_pipe_info(in); |
1340 | opipe = pipe_info(out->f_path.dentry->d_inode); | 1339 | opipe = get_pipe_info(out); |
1341 | 1340 | ||
1342 | if (ipipe && opipe) { | 1341 | if (ipipe && opipe) { |
1343 | if (off_in || off_out) | 1342 | if (off_in || off_out) |
@@ -1555,7 +1554,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *iov, | |||
1555 | int error; | 1554 | int error; |
1556 | long ret; | 1555 | long ret; |
1557 | 1556 | ||
1558 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1557 | pipe = get_pipe_info(file); |
1559 | if (!pipe) | 1558 | if (!pipe) |
1560 | return -EBADF; | 1559 | return -EBADF; |
1561 | 1560 | ||
@@ -1642,7 +1641,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1642 | }; | 1641 | }; |
1643 | long ret; | 1642 | long ret; |
1644 | 1643 | ||
1645 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1644 | pipe = get_pipe_info(file); |
1646 | if (!pipe) | 1645 | if (!pipe) |
1647 | return -EBADF; | 1646 | return -EBADF; |
1648 | 1647 | ||
@@ -2022,8 +2021,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
2022 | static long do_tee(struct file *in, struct file *out, size_t len, | 2021 | static long do_tee(struct file *in, struct file *out, size_t len, |
2023 | unsigned int flags) | 2022 | unsigned int flags) |
2024 | { | 2023 | { |
2025 | struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode); | 2024 | struct pipe_inode_info *ipipe = get_pipe_info(in); |
2026 | struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode); | 2025 | struct pipe_inode_info *opipe = get_pipe_info(out); |
2027 | int ret = -EINVAL; | 2026 | int ret = -EINVAL; |
2028 | 2027 | ||
2029 | /* | 2028 | /* |