From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: stable@vger.kernel.org, patches@lists.linux.dev,
Xiaoli Feng <xifeng@redhat.com>,
"Paulo Alcantara (Red Hat)" <pc@manguebit.org>,
David Howells <dhowells@redhat.com>,
netfs@lists.linux.dev, linux-cifs@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH 6.12 634/666] netfs: fix error handling in netfs_extract_user_iter()
Date: Sat, 23 May 2026 11:22:55 +0200 [thread overview]
Message-ID: <2026052349-handset-ambiguity-b618@gregkh> (raw)
In-Reply-To: <7ed573be-1df9-43ee-bfef-4499af0767b4@oracle.com>
On Sat, May 23, 2026 at 01:53:15AM +0530, Harshit Mogalapalli wrote:
> Hi Greg/Sasha,
>
> On 20/05/26 21:54, Greg Kroah-Hartman wrote:
> > 6.12-stable review patch. If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: Paulo Alcantara <pc@manguebit.org>
> >
> > commit 0aad5704c6b4d14007d4eab15883e8524e4310f4 upstream.
> >
> > In netfs_extract_user_iter(), if iov_iter_extract_pages() failed to
> > extract user pages, bail out on -ENOMEM, otherwise return the error
> > code only if @npages == 0, allowing short DIO reads and writes to be
> > issued.
> >
> > This fixes mmapstress02 from LTP tests against CIFS.
> >
> > Fixes: 85dd2c8ff368 ("netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator")
> > Reported-by: Xiaoli Feng <xifeng@redhat.com>
> > Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
> > Signed-off-by: David Howells <dhowells@redhat.com>
> > Link: https://patch.msgid.link/20260512123404.719402-10-dhowells@redhat.com
> > Cc: netfs@lists.linux.dev
> > Cc: stable@vger.kernel.org
> > Cc: linux-cifs@vger.kernel.org
> > Cc: linux-fsdevel@vger.kernel.org
> > Signed-off-by: Christian Brauner <brauner@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > fs/netfs/iterator.c | 13 ++++++++++---
> > 1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > --- a/fs/netfs/iterator.c
> > +++ b/fs/netfs/iterator.c
> > @@ -22,7 +22,7 @@
> > *
> > * Extract the page fragments from the given amount of the source iterator and
> > * build up a second iterator that refers to all of those bits. This allows
> > - * the original iterator to disposed of.
> > + * the original iterator to be disposed of.
> > *
> > * @extraction_flags can have ITER_ALLOW_P2PDMA set to request peer-to-peer DMA be
> > * allowed on the pages extracted.
> > @@ -67,8 +67,8 @@ ssize_t netfs_extract_user_iter(struct i
> > ret = iov_iter_extract_pages(orig, &pages, count,
> > max_pages - npages, extraction_flags,
> > &offset);
> > - if (ret < 0) {
> > - pr_err("Couldn't get user pages (rc=%zd)\n", ret);
> > + if (unlikely(ret <= 0)) {
> > + ret = ret ?: -EIO;
> > break;
> > }
> > @@ -97,6 +97,13 @@ ssize_t netfs_extract_user_iter(struct i
> > npages += cur_npages;
> > }
> > + if (ret < 0 && (ret == -ENOMEM || npages == 0)) {
> > + for (i = 0; i < npages; i++)
> > + unpin_user_page(bv[i].bv_page);
> > + kvfree(bv);
> > + return ret;
> > + }
> > +
>
> I have run an AI assisted backport review and it spotted an issue: I
> have taken a look and the issues goes like:
>
> Upstream has:
>
>
>
> ssize_t ret = 0;
>
> ...
> if (ret < 0 && (ret == -ENOMEM || npages == 0)) {
> for (i = 0; i < npages; i++)
> unpin_user_page(bv[i].bv_page);
> kvfree(bv);
> return ret;
> }
>
> 6.12.y has:
>
> ssize_t ret;
>
> ...
> if (ret < 0 && (ret == -ENOMEM || npages == 0)) {
> for (i = 0; i < npages; i++)
> unpin_user_page(bv[i].bv_page);
> kvfree(bv);
> return ret;
> }
>
> I think 6.12.y misses commit: 7e3d8db899d5 ("netfs: Fix potential
> uninitialised var in netfs_extract_user_iter()") so backport might not be
> complete, thoughts ?
Now applied, thanks.
greg k-h
prev parent reply other threads:[~2026-05-23 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260520162111.222830634@linuxfoundation.org>
2026-05-20 16:24 ` [PATCH 6.12 634/666] netfs: fix error handling in netfs_extract_user_iter() Greg Kroah-Hartman
2026-05-22 20:23 ` Harshit Mogalapalli
2026-05-23 9:22 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026052349-handset-ambiguity-b618@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=patches@lists.linux.dev \
--cc=pc@manguebit.org \
--cc=stable@vger.kernel.org \
--cc=xifeng@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox