Commit e2b71389 authored by Konstantin Khorenko's avatar Konstantin Khorenko Committed by Greg Kroah-Hartman

NFSD: memory corruption due to writing beyond the stat array

commit 3aa6e0aa upstream.

If nfsd fails to find an exported via NFS file in the readahead cache, it
should increment corresponding nfsdstats counter (ra_depth[10]), but due to a
bug it may instead write to ra_depth[11], corrupting the following field.

In a kernel with NFSDv4 compiled in the corruption takes the form of an
increment of a counter of the number of NFSv4 operation 0's received; since
there is no operation 0, this is harmless.

In a kernel with NFSDv4 disabled it corrupts whatever happens to be in the
memory beyond nfsdstats.
Signed-off-by: default avatarKonstantin Khorenko <khorenko@openvz.org>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dd5c3241
...@@ -823,7 +823,7 @@ nfsd_get_raparms(dev_t dev, ino_t ino) ...@@ -823,7 +823,7 @@ nfsd_get_raparms(dev_t dev, ino_t ino)
if (ra->p_count == 0) if (ra->p_count == 0)
frap = rap; frap = rap;
} }
depth = nfsdstats.ra_size*11/10; depth = nfsdstats.ra_size;
if (!frap) { if (!frap) {
spin_unlock(&rab->pb_lock); spin_unlock(&rab->pb_lock);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment