Skip to content

Commit 3153cb6

Browse files
committed
NFSD enforce filehandle check for source file in COPY
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Olga Kornievskaia <kolga@netapp.com> commit 754035f 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> (cherry picked from commit 754035f) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 14309e1 commit 3153cb6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,13 @@ static int nfsd4_do_async_copy(void *data)
17671767
filp = nfs42_ssc_open(copy->ss_mnt, &copy->c_fh,
17681768
&copy->stateid);
17691769
if (IS_ERR(filp)) {
1770-
nfserr = nfserr_offload_denied;
1770+
switch (PTR_ERR(filp)) {
1771+
case -EBADF:
1772+
nfserr = nfserr_wrong_type;
1773+
break;
1774+
default:
1775+
nfserr = nfserr_offload_denied;
1776+
}
17711777
nfsd4_interssc_disconnect(copy->ss_mnt);
17721778
goto do_callback;
17731779
}

0 commit comments

Comments
 (0)