public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Olga Kornievskaia <olga.kornievskaia@gmail.com>, chuck.level@oracle.come
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] NFSD enforce filehandle check for source file in COPY
Date: Fri, 19 Aug 2022 15:41:25 -0400	[thread overview]
Message-ID: <19f46780bd8716ff9661591746df670b28103228.camel@kernel.org> (raw)
In-Reply-To: <20220819191636.68024-1-olga.kornievskaia@gmail.com>

On Fri, 2022-08-19 at 15:16 -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
> 
> 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>
> ---
>  fs/nfsd/nfs4proc.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index a72ab97f77ef..d8f05d96fe68 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, &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;
> +			}
>  			nfsd4_interssc_disconnect(copy->ss_mnt);
>  			goto do_callback;
>  		}

Reviewed-by: Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2022-08-19 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 19:16 [PATCH 1/1] NFSD enforce filehandle check for source file in COPY Olga Kornievskaia
2022-08-19 19:41 ` Jeff Layton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19f46780bd8716ff9661591746df670b28103228.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.level@oracle.come \
    --cc=linux-nfs@vger.kernel.org \
    --cc=olga.kornievskaia@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox