[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YaTbDJS5MtvIm9aS@arm.com>
Date: Mon, 29 Nov 2021 13:52:12 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: Andreas Gruenbacher <agruenba@...hat.com>
Cc: Matthew Wilcox <willy@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Will Deacon <will@...nel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>
Subject: Re: [PATCH 3/3] btrfs: Avoid live-lock in search_ioctl() on hardware
with sub-page faults
On Sat, Nov 27, 2021 at 07:05:39PM +0100, Andreas Gruenbacher wrote:
> Maybe you want to add this though:
>
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -2202,3 +2202,3 @@ static noinline int search_ioctl(struct inode *inode,
> unsigned long sk_offset = 0;
> - char __user *fault_in_addr;
> + char __user *fault_in_addr, *end;
>
> @@ -2230,6 +2230,6 @@ static noinline int search_ioctl(struct inode *inode,
> fault_in_addr = ubuf;
> + end = ubuf + *buf_size;
> while (1) {
> ret = -EFAULT;
> - if (fault_in_writeable(fault_in_addr,
> - *buf_size - (fault_in_addr - ubuf)))
> + if (fault_in_writeable(fault_in_addr, end - fault_in_addr))
> break;
It looks like *buf_size is updated inside copy_to_sk(), so I'll move the
end update inside the loop.
--
Catalin
Powered by blists - more mailing lists