<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/nfsd, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-03-23T07:19:03Z</updated>
<entry>
<title>nfsd: fix wrong check in write_v4_end_grace()</title>
<updated>2019-03-23T07:19:03Z</updated>
<author>
<name>Yihao Wu</name>
</author>
<published>2019-03-06T13:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3127b10f2e45739f532f6b3b15f2c8187c0904d6'/>
<id>urn:sha1:3127b10f2e45739f532f6b3b15f2c8187c0904d6</id>
<content type='text'>
commit dd838821f0a29781b185cd8fb8e48d5c177bd838 upstream.

Commit 62a063b8e7d1 "nfsd4: fix crash on writing v4_end_grace before
nfsd startup" is trying to fix a NULL dereference issue, but it
mistakenly checks if the nfsd server is started. So fix it.

Fixes: 62a063b8e7d1 "nfsd4: fix crash on writing v4_end_grace before nfsd startup"
Cc: stable@vger.kernel.org
Reviewed-by: Joseph Qi &lt;joseph.qi@linux.alibaba.com&gt;
Signed-off-by: Yihao Wu &lt;wuyihao@linux.alibaba.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd: fix memory corruption caused by readdir</title>
<updated>2019-03-23T07:19:02Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2019-03-04T03:08:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=695cf5a1c7f8084cae5983ebcdb74df36d328642'/>
<id>urn:sha1:695cf5a1c7f8084cae5983ebcdb74df36d328642</id>
<content type='text'>
commit b602345da6cbb135ba68cf042df8ec9a73da7981 upstream.

If the result of an NFSv3 readdir{,plus} request results in the
"offset" on one entry having to be split across 2 pages, and is sized
so that the next directory entry doesn't fit in the requested size,
then memory corruption can happen.

When encode_entry() is called after encoding the last entry that fits,
it notices that -&gt;offset and -&gt;offset1 are set, and so stores the
offset value in the two pages as required.  It clears -&gt;offset1 but
*does not* clear -&gt;offset.

Normally this omission doesn't matter as encode_entry_baggage() will
be called, and will set -&gt;offset to a suitable value (not on a page
boundary).
But in the case where cd-&gt;buflen &lt; elen and nfserr_toosmall is
returned, -&gt;offset is not reset.

This means that nfsd3proc_readdirplus will see -&gt;offset with a value 4
bytes before the end of a page, and -&gt;offset1 set to NULL.
It will try to write 8bytes to -&gt;offset.
If we are lucky, the next page will be read-only, and the system will
  BUG: unable to handle kernel paging request at...

If we are unlucky, some innocent page will have the first 4 bytes
corrupted.

nfsd3proc_readdir() doesn't even check for -&gt;offset1, it just blindly
writes 8 bytes to the offset wherever it is.

Fix this by clearing -&gt;offset after it is used, and copying the
-&gt;offset handling code from nfsd3_proc_readdirplus into
nfsd3_proc_readdir.

(Note that the commit hash in the Fixes tag is from the 'history'
 tree - this bug predates git).

Fixes: 0b1d57cf7654 ("[PATCH] kNFSd: Fix nfs3 dentry encoding")
Fixes-URL: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=0b1d57cf7654
Cc: stable@vger.kernel.org (v2.6.12+)
Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: fix crash on writing v4_end_grace before nfsd startup</title>
<updated>2019-02-20T09:08:57Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2018-11-27T20:54:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9fb787cb5f2d362c60adff66f883fc0b68a1e804'/>
<id>urn:sha1:9fb787cb5f2d362c60adff66f883fc0b68a1e804</id>
<content type='text'>
[ Upstream commit 62a063b8e7d1db684db3f207261a466fa3194e72 ]

Anatoly Trosinenko reports that this:

1) Checkout fresh master Linux branch (tested with commit e195ca6cb)
2) Copy x84_64-config-4.14 to .config, then enable NFS server v4 and build
3) From `kvm-xfstests shell`:

results in NULL dereference in locks_end_grace.

Check that nfsd has been started before trying to end the grace period.

Reported-by: Anatoly Trosinenko &lt;anatoly.trosinenko@gmail.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>nfsd: fix corrupted reply to badly ordered compound</title>
<updated>2018-10-13T07:09:27Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2018-06-13T19:21:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0fb40f7dd3f3db51592bb0b0d7417ab781d1b016'/>
<id>urn:sha1:0fb40f7dd3f3db51592bb0b0d7417ab781d1b016</id>
<content type='text'>
[ Upstream commit 5b7b15aee641904ae269be9846610a3950cbd64c ]

We're encoding a single op in the reply but leaving the number of ops
zero, so the reply makes no sense.

Somewhat academic as this isn't a case any real client will hit, though
in theory perhaps that could change in a future protocol extension.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nfsd: restrict rd_maxcount to svc_max_payload in nfsd_encode_readdir</title>
<updated>2018-07-03T09:18:48Z</updated>
<author>
<name>Scott Mayhew</name>
</author>
<published>2018-05-07T13:01:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=626fb93235dc1cc8c52478712737ffd4451301e7'/>
<id>urn:sha1:626fb93235dc1cc8c52478712737ffd4451301e7</id>
<content type='text'>
commit 9c2ece6ef67e9d376f32823086169b489c422ed0 upstream.

nfsd4_readdir_rsize restricts rd_maxcount to svc_max_payload when
estimating the size of the readdir reply, but nfsd_encode_readdir
restricts it to INT_MAX when encoding the reply.  This can result in log
messages like "kernel: RPC request reserved 32896 but used 1049444".

Restrict rd_dircount similarly (no reason it should be larger than
svc_max_payload).

Signed-off-by: Scott Mayhew &lt;smayhew@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd: check for use of the closed special stateid</title>
<updated>2018-02-07T19:07:55Z</updated>
<author>
<name>Andrew Elble</name>
</author>
<published>2017-11-09T18:41:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=07397e4f9b4da7de809103278cbd3a82d8793b54'/>
<id>urn:sha1:07397e4f9b4da7de809103278cbd3a82d8793b54</id>
<content type='text'>
[ Upstream commit ae254dac721d44c0bfebe2795df87459e2e88219 ]

Prevent the use of the closed (invalid) special stateid by clients.

Signed-off-by: Andrew Elble &lt;aweits@rit.edu&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x&gt;0)</title>
<updated>2018-02-07T19:07:55Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2017-11-03T12:00:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1f71aa238fcde9356376d6d885d216adbf19d18a'/>
<id>urn:sha1:1f71aa238fcde9356376d6d885d216adbf19d18a</id>
<content type='text'>
[ Upstream commit fb500a7cfee7f2f447d2bbf30cb59629feab6ac1 ]

Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>NFSD: fix nfsd_reset_versions for NFSv4.</title>
<updated>2017-12-20T09:01:29Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2017-03-10T00:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c1ecb5aba022bc00434642a70e085eb86e92952d'/>
<id>urn:sha1:c1ecb5aba022bc00434642a70e085eb86e92952d</id>
<content type='text'>
[ Upstream commit 800a938f0bf9130c8256116649c0cc5806bfb2fd ]

If you write "-2 -3 -4" to the "versions" file, it will
notice that no versions are enabled, and nfsd_reset_versions()
is called.
This enables all major versions, not no minor versions.
So we lose the invariant that NFSv4 is only advertised when
at least one minor is enabled.

Fix the code to explicitly enable minor versions for v4,
change it to use nfsd_vers() to test and set, and simplify
the code.

Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>NFSD: fix nfsd_minorversion(.., NFSD_AVAIL)</title>
<updated>2017-12-20T09:01:29Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2017-03-10T00:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=537546e6e440a2f5a0636880fc6d4a497d65016a'/>
<id>urn:sha1:537546e6e440a2f5a0636880fc6d4a497d65016a</id>
<content type='text'>
[ Upstream commit 928c6fb3a9bfd6c5b287aa3465226add551c13c0 ]

Current code will return 1 if the version is supported,
and -1 if it isn't.
This is confusing and inconsistent with the one place where this
is used.
So change to return 1 if it is supported, and zero if not.
i.e. an error is never returned.

Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nfsd: deal with revoked delegations appropriately</title>
<updated>2017-11-30T08:35:51Z</updated>
<author>
<name>Andrew Elble</name>
</author>
<published>2017-11-03T18:06:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6b9f616effa8401bdd393099cb17adb5f7ecd3a4'/>
<id>urn:sha1:6b9f616effa8401bdd393099cb17adb5f7ecd3a4</id>
<content type='text'>
commit 95da1b3a5aded124dd1bda1e3cdb876184813140 upstream.

If a delegation has been revoked by the server, operations using that
delegation should error out with NFS4ERR_DELEG_REVOKED in the &gt;4.1
case, and NFS4ERR_BAD_STATEID otherwise.

The server needs NFSv4.1 clients to explicitly free revoked delegations.
If the server returns NFS4ERR_DELEG_REVOKED, the client will do that;
otherwise it may just forget about the delegation and be unable to
recover when it later sees SEQ4_STATUS_RECALLABLE_STATE_REVOKED set on a
SEQUENCE reply.  That can cause the Linux 4.1 client to loop in its
stage manager.

Signed-off-by: Andrew Elble &lt;aweits@rit.edu&gt;
Reviewed-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
