提交 8d0256c1 编写于 作者: O Olga Kornievskaia 提交者: Zheng Zengkai

NFSv4.2 fix handling of sr_eof in SEEK's reply

stable inclusion
from stable-5.10.38
commit bfeb4e607d00a01586116a134f4090ceb23a4eb3
bugzilla: 51875
CVE: NA

--------------------------------

[ Upstream commit 73f5c88f ]

Currently the client ignores the value of the sr_eof of the SEEK
operation. According to the spec, if the server didn't find the
requested extent and reached the end of the file, the server
would return sr_eof=true. In case the request for DATA and no
data was found (ie in the middle of the hole), then the lseek
expects that ENXIO would be returned.

Fixes: 1c6dcbe5 ("NFS: Implement SEEK")
Signed-off-by: NOlga Kornievskaia <kolga@netapp.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e8f13167
......@@ -665,7 +665,10 @@ static loff_t _nfs42_proc_llseek(struct file *filep,
if (status)
return status;
return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
if (whence == SEEK_DATA && res.sr_eof)
return -NFS4ERR_NXIO;
else
return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
}
loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册