diff options
| -rw-r--r-- | fs/splice.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/fs/splice.c b/fs/splice.c index 4bbfa95b5bfe..41cbb16299e0 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
| @@ -1533,34 +1533,29 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *uiov, | |||
| 1533 | struct iovec iovstack[UIO_FASTIOV]; | 1533 | struct iovec iovstack[UIO_FASTIOV]; |
| 1534 | struct iovec *iov = iovstack; | 1534 | struct iovec *iov = iovstack; |
| 1535 | struct iov_iter iter; | 1535 | struct iov_iter iter; |
| 1536 | ssize_t count; | ||
| 1537 | 1536 | ||
| 1538 | pipe = get_pipe_info(file); | 1537 | pipe = get_pipe_info(file); |
| 1539 | if (!pipe) | 1538 | if (!pipe) |
| 1540 | return -EBADF; | 1539 | return -EBADF; |
| 1541 | 1540 | ||
| 1542 | ret = rw_copy_check_uvector(READ, uiov, nr_segs, | 1541 | ret = import_iovec(READ, uiov, nr_segs, |
| 1543 | ARRAY_SIZE(iovstack), iovstack, &iov); | 1542 | ARRAY_SIZE(iovstack), &iov, &iter); |
| 1544 | if (ret <= 0) | 1543 | if (ret < 0) |
| 1545 | goto out; | 1544 | return ret; |
| 1546 | |||
| 1547 | count = ret; | ||
| 1548 | iov_iter_init(&iter, READ, iov, nr_segs, count); | ||
| 1549 | 1545 | ||
| 1546 | sd.total_len = iov_iter_count(&iter); | ||
| 1550 | sd.len = 0; | 1547 | sd.len = 0; |
| 1551 | sd.total_len = count; | ||
| 1552 | sd.flags = flags; | 1548 | sd.flags = flags; |
| 1553 | sd.u.data = &iter; | 1549 | sd.u.data = &iter; |
| 1554 | sd.pos = 0; | 1550 | sd.pos = 0; |
| 1555 | 1551 | ||
| 1556 | pipe_lock(pipe); | 1552 | if (sd.total_len) { |
| 1557 | ret = __splice_from_pipe(pipe, &sd, pipe_to_user); | 1553 | pipe_lock(pipe); |
| 1558 | pipe_unlock(pipe); | 1554 | ret = __splice_from_pipe(pipe, &sd, pipe_to_user); |
| 1559 | 1555 | pipe_unlock(pipe); | |
| 1560 | out: | 1556 | } |
| 1561 | if (iov != iovstack) | ||
| 1562 | kfree(iov); | ||
| 1563 | 1557 | ||
| 1558 | kfree(iov); | ||
| 1564 | return ret; | 1559 | return ret; |
| 1565 | } | 1560 | } |
| 1566 | 1561 | ||
