From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org, nfsv4@linux-nfs.org
Subject: Re: [PATCH] sunrpc: on successful gss error pipe write, don't return error (try #2)
Date: Fri, 18 Dec 2009 15:24:26 -0500 [thread overview]
Message-ID: <1261167866.3420.40.camel@localhost> (raw)
In-Reply-To: <20091218151345.5e86149d@tlielax.poochiereds.net>
On Fri, 2009-12-18 at 15:13 -0500, Jeff Layton wrote:
> On Fri, 18 Dec 2009 14:05:39 -0500
> Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
>
> > On Fri, 2009-12-18 at 11:27 -0500, Jeff Layton wrote:
> > > When handling the gssd downcall, the kernel should distinguish between a
> > > successful downcall that contains an error code and a failed downcall
> > > (i.e. where the parsing failed or some other sort of problem occurred).
> > >
> > > In the former case, gss_pipe_downcall should be returning the number of
> > > bytes written to the pipe instead of an error.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > > ---
> > > net/sunrpc/auth_gss/auth_gss.c | 3 +++
> > > 1 files changed, 3 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
> > > index 3c3c50f..7afc8e2 100644
> > > --- a/net/sunrpc/auth_gss/auth_gss.c
> > > +++ b/net/sunrpc/auth_gss/auth_gss.c
> > > @@ -645,6 +645,9 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
> > > if (IS_ERR(p)) {
> > > err = PTR_ERR(p);
> > > gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
> > > + /* special case: downcall was successful, but held an error */
> > > + if (err == -EACCES)
> > > + err = mlen;
> >
> > That line immediately above your fix still looks wrong. The point is
> > that AFAICS, err is never going to be set to EAGAIN. It can be EFAULT,
> > ENOSYS, or ENOMEM, but it will never be EAGAIN...
> >
> > I think we should rather reverse that test. Really, what we want to do,
> > is to set msg.errno to -EAGAIN for -EFAULT and -ENOMEM (and probably for
> > ENOSYS too), and then set it to -EACCES _only_ in the case where the
> > user was not authorised.
>
> What should we do if err is "none of the above"? Set msg.errno to
> -EACCES and return the error to the pipe writer?
>
The question is will it ever be 'none of the above'? We clearly cannot
be returning arbitrary errors to gssd, so we need to define a set that
makes sense. The only other error I can see that we might to add to the
above list, would be EINVAL (to mean 'you just sent me some garbage
argument that I cannot decode').
Retrying the upcall would seem to be the correct thing to do in case of
EINVAL too...
Trond
next prev parent reply other threads:[~2009-12-18 20:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-18 16:27 [PATCH] sunrpc: on successful gss error pipe write, don't return error (try #2) Jeff Layton
2009-12-18 19:05 ` Trond Myklebust
2009-12-18 20:13 ` Jeff Layton
2009-12-18 20:24 ` Trond Myklebust [this message]
2009-12-18 20:38 ` Jeff Layton
2009-12-18 20:56 ` Trond Myklebust
2009-12-18 21:02 ` Trond Myklebust
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=1261167866.3420.40.camel@localhost \
--to=trond.myklebust@netapp.com \
--cc=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
/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;
as well as URLs for NNTP newsgroup(s).