[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2101064.1714118434@warthog.procyon.org.uk>
Date: Fri, 26 Apr 2024 09:00:34 +0100
From: David Howells <dhowells@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: dhowells@...hat.com, netdev@...r.kernel.org,
Jeff Layton <jlayton@...nel.org>, Steve French <sfrench@...ba.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S.
Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
netfs@...ts.linux.dev, linux-crypto@...r.kernel.org,
linux-cifs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] Fix a potential infinite loop in extract_user_to_sg()
Jakub Kicinski <kuba@...nel.org> wrote:
> On Thu, 25 Apr 2024 09:39:32 +0100 David Howells wrote:
> > Fix extract_user_to_sg() so that it will break out of the loop if
> > iov_iter_extract_pages() returns 0 rather than looping around forever.
>
> Is "goto fail" the right way to break out here?
> My intuition would be "break".
>
> On a quick read it seems like res = 0 may occur if we run out of
> iterator, is passing maxsize > iter->count illegal?
I would say that you're not allowed to ask for more than is in the iterator.
In a number of places this is called, it's a clear failure if you can't get
that the requested amount out of it - for example, if we're building a cifs
message and have set all the fields in the header and are trying to encrypt
the message.
David
Powered by blists - more mailing lists