public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Petr Malat <oss@malat.biz>,
	Trond Myklebust <trond.myklebust@hammerspace.com>,
	Benjamin Coddington <bcodding@redhat.com>,
	Anna Schumaker <Anna.Schumaker@netapp.com>,
	stable <stable@vger.kernel.org>,
	Security Officers <security@kernel.org>
Subject: Re: [PATCH] NFS: Remove superfluous kmap in nfs_readdir_xdr_to_array
Date: Fri, 13 Mar 2020 20:00:55 -0400	[thread overview]
Message-ID: <20200314000055.GG1349@sasha-vm> (raw)
In-Reply-To: <CAHk-=wgbhYWxprGr1puAabZZFp4O3myBv-W9dJCVYt8r=dxZNQ@mail.gmail.com>

On Fri, Mar 13, 2020 at 02:05:27PM -0700, Linus Torvalds wrote:
>Adding more people.
>
>The old stable trees seem to have rather different code.
>
>[ Goes off and looks at the stable trees ]
>
>Petr seems entirely correct - the stable tree backport appears broken.
>
>Because looking at that commit 67a56e9743171 in the stable tree, it
>doesn't seem to match commit 4b310319c6a8 ("NFS: Fix memory leaks and
>corruption in readdir") in mainline.
>
>That stable backport looks bogus. It added that
>
>        array = kmap(page);
>
>line from somewhere else, probably because the stable tree didn't have
>the line at all, and it was there in the context.

I botched up that backport, sorry.

>Because while mainline has that line to initialize array with kmap(),
>in those stable trees, we have
>
>        array = nfs_readdir_get_array(page);
>
>and as Petr says, the kmap has been done there already, and it will be
>kunmap'ed by nfs_readdir_release_array().
>
>And looking closer, this same bug seems to have happened twice: it
>also exists in 0b0223f9c3a8.
>
>But somebody else should double-check me - somebody who actually knows the code.
>
>As to how I found the other case, do this in the stable git repo with
>all the stable tags:
>
>    git log -p --no-merges --all \
>        --grep="NFS: Fix memory leaks and corruption in readdir"
>
>to see all the copies of that commit backport.
>
>Add a
>
>    -S'kmap(page)'
>
>to that line to see the cases that added that line. Or to just get the commits:
>
>    git log --oneline --no-merges --all \
>        --grep="NFS: Fix memory leaks and corruption in readdir" \
>        -S'kmap(page)'
>
>and the result is
>
>    67a56e974317 NFS: Fix memory leaks and corruption in readdir
>    0b0223f9c3a8 NFS: Fix memory leaks and corruption in readdir

I've applied to fix to the 4.9 and 4.4 trees, thank you!

-- 
Thanks,
Sasha

      reply	other threads:[~2020-03-14  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 20:24 [PATCH] NFS: Remove superfluous kmap in nfs_readdir_xdr_to_array Petr Malat
2020-03-13 21:05 ` Linus Torvalds
2020-03-14  0:00   ` Sasha Levin [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=20200314000055.GG1349@sasha-vm \
    --to=sashal@kernel.org \
    --cc=Anna.Schumaker@netapp.com \
    --cc=bcodding@redhat.com \
    --cc=oss@malat.biz \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=trond.myklebust@hammerspace.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