[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87wr1crnxl.fsf@tucsk.pomaz.szeredi.hu>
Date: Mon, 06 Aug 2012 18:21:42 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: Zach Brown <zab@...hat.com>
Cc: fuse-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fuse: verify all ioctl retry iov elements
Zach Brown <zab@...hat.com> writes:
> Commit 7572777eef78ebdee1ecb7c258c0ef94d35bad16 attempted to verify that
> the total iovec from the client doesn't overflow iov_length() but it
> only checked the first element. The iovec could still overflow by
> starting with a small element. The obvious fix is to check all the
> elements.
>
> The overflow case doesn't look dangerous to the kernel as the copy is
> limited by the length after the overflow. This fix restores the
> intention of returning an error instead of successfully copying less
> than the iovec represented.
>
> I found this by code inspection. I built it but don't have a test case.
> I'm cc:ing stable because the initial commit did as well.
Thanks! Applied.
Miklos
>
> Signed-off-by: Zach Brown <zab@...hat.com>
> CC: <stable@...nel.org> [2.6.37+]
> ---
> fs/fuse/file.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index b321a68..514f12a 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1700,7 +1700,7 @@ static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count)
> size_t n;
> u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT;
>
> - for (n = 0; n < count; n++) {
> + for (n = 0; n < count; n++, iov++) {
> if (iov->iov_len > (size_t) max)
> return -ENOMEM;
> max -= iov->iov_len;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists