NFS: fix an incorrect limit in filelayout_decode_layout()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 11 May 2021 08:49:42 +0000 (11:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 06:36:18 +0000 (08:36 +0200)
commitf299522eda1566cbfbae4b15c82970fc41b03714
tree2cc4a39c2dbad93e9746ce2946d83aecd35e6c55
parent6f6ac2a7959b1864886d07fcf3b9cec587dfe635
NFS: fix an incorrect limit in filelayout_decode_layout()

commit 769b01ea68b6c49dc3cde6adf7e53927dacbd3a8 upstream.

The "sizeof(struct nfs_fh)" is two bytes too large and could lead to
memory corruption.  It should be NFS_MAXFHSIZE because that's the size
of the ->data[] buffer.

I reversed the size of the arguments to put the variable on the left.

Fixes: 16b374ca439f ("NFSv4.1: pnfs: filelayout: add driver's LAYOUTGET and GETDEVICEINFO infrastructure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/filelayout/filelayout.c