NFSD enforce filehandle check for source file in COPY

[ Upstream commit 754035ff79 ]

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>
[ cel: adjusted to apply to v5.15.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Olga Kornievskaia 2022-08-19 15:16:36 -04:00 коммит произвёл Greg Kroah-Hartman
Родитель 2855799289
Коммит 5b6441a5d3
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -1760,7 +1760,13 @@ static int nfsd4_do_async_copy(void *data)
filp = nfs42_ssc_open(copy->ss_mnt, &copy->c_fh,
&copy->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;
}
/* ss_mnt will be unmounted by the laundromat */
goto do_callback;
}