OSDN Git Service

nfsd: Return EPERM, not EACCES, in some SETATTR cases
authorzhengbin <zhengbin13@huawei.com>
Fri, 30 Nov 2018 08:04:25 +0000 (16:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:52:26 +0000 (08:52 +0100)
commit1ff89e6d4b2332801bfaf5ab3cfd6660b7096bd0
treed62356e0cea4f7ee7d419993a9a1e7556aeca9be
parentef51042de4b497e2c2baaabfd176815cd6e8b5c1
nfsd: Return EPERM, not EACCES, in some SETATTR cases

[ Upstream commit 255fbca65137e25b12bced18ec9a014dc77ecda0 ]

As the man(2) page for utime/utimes states, EPERM is returned when the
second parameter of utime or utimes is not NULL, the caller's effective UID
does not match the owner of the file, and the caller is not privileged.

However, in a NFS directory mounted from knfsd, it will return EACCES
(from nfsd_setattr-> fh_verify->nfsd_permission).  This patch fixes
that.

Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/vfs.c