Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28b7691a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "AIO: properly check iovec sizes"

parents 8d769156 57c463e4
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1354,11 +1354,16 @@ static ssize_t aio_setup_single_vector(struct kiocb *kiocb,
				       unsigned long *nr_segs,
				       struct iovec *iovec)
{
	if (unlikely(!access_ok(!rw, buf, kiocb->ki_nbytes)))
	size_t len = kiocb->ki_nbytes;

	if (len > MAX_RW_COUNT)
		len = MAX_RW_COUNT;

	if (unlikely(!access_ok(!rw, buf, len)))
		return -EFAULT;

	iovec->iov_base = buf;
	iovec->iov_len = kiocb->ki_nbytes;
	iovec->iov_len = len;
	*nr_segs = 1;
	return 0;
}