diff options
author | Olga Kornievskaia <kolga@netapp.com> | 2022-08-19 21:16:36 +0200 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2022-09-26 20:02:20 +0200 |
commit | 754035ff79a14886e68c0c9f6fa80adb21f12b53 (patch) | |
tree | 080b5afd81c377e6eb4a5568a6d2d1ab87e31b39 /fs/nfsd/nfs4proc.c | |
parent | lockd: move from strlcpy with unused retval to strscpy (diff) | |
download | linux-754035ff79a14886e68c0c9f6fa80adb21f12b53.tar.xz linux-754035ff79a14886e68c0c9f6fa80adb21f12b53.zip |
NFSD enforce filehandle check for source file in COPY
If the passed in filehandle for the source file in the COPY operation
is not a regular file, the server MUST return NFS4ERR_WRONG_TYPE.
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to '')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0437210b9898..757d8959f992 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1768,7 +1768,13 @@ static int nfsd4_do_async_copy(void *data) filp = nfs42_ssc_open(copy->ss_mnt, ©->c_fh, ©->stateid); if (IS_ERR(filp)) { - nfserr = nfserr_offload_denied; + switch (PTR_ERR(filp)) { + case -EBADF: + nfserr = nfserr_wrong_type; + break; + default: + nfserr = nfserr_offload_denied; + } nfsd4_interssc_disconnect(copy->ss_mnt); goto do_callback; } |