From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, nfsv4@linux-nfs.org
Subject: [PATCH] sunrpc: on successful gss error pipe write, don't return error
Date: Fri, 18 Dec 2009 08:56:14 -0500 [thread overview]
Message-ID: <1261144574-1642-1-git-send-email-jlayton@redhat.com> (raw)
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 | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 3c3c50f..03cc5a4 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -184,7 +184,8 @@ gss_alloc_context(void)
#define GSSD_MIN_TIMEOUT (60 * 60)
static const void *
-gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct gss_api_mech *gm)
+gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx,
+ struct gss_api_mech *gm, ssize_t *downcall_err)
{
const void *q;
unsigned int seclen;
@@ -208,6 +209,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
if (ctx->gc_win == 0) {
/* in which case, p points to an error code which we ignore */
p = ERR_PTR(-EACCES);
+ *downcall_err = -EACCES;
goto err;
}
/* copy the opaque wire context */
@@ -641,10 +643,21 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
list_del_init(&gss_msg->list);
spin_unlock(&inode->i_lock);
- p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
+ err = 0;
+ p = gss_fill_context(p, end, ctx, gss_msg->auth->mech, &err);
if (IS_ERR(p)) {
- err = PTR_ERR(p);
- gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
+ /*
+ * a non-zero downcall_err indicates that downcall write was
+ * OK, but contained a zero gc_win (and hence an error code).
+ */
+ if (err) {
+ gss_msg->msg.errno = err;
+ err = mlen;
+ } else {
+ err = PTR_ERR(p);
+ gss_msg->msg.errno = (err == -EAGAIN) ?
+ -EAGAIN : -EACCES;
+ }
goto err_release_msg;
}
gss_msg->ctx = gss_get_ctx(ctx);
--
1.6.5.2
next reply other threads:[~2009-12-18 13:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-18 13:56 Jeff Layton [this message]
2009-12-18 14:11 ` [PATCH] sunrpc: on successful gss error pipe write, don't return error Trond Myklebust
2009-12-18 14:39 ` Jeff Layton
[not found] ` <20091218093912.1c426ad6-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2009-12-18 14:47 ` Trond Myklebust
2009-12-18 15:12 ` Trond Myklebust
2009-12-18 15:37 ` Jeff Layton
[not found] ` <20091218103723.38510cce-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2009-12-18 18:30 ` Trond Myklebust
2009-12-18 19:14 ` Jeff Layton
2009-12-18 19:42 ` Trond Myklebust
2009-12-18 15:25 ` Jeff Layton
2009-12-18 16:25 ` Jeff Layton
2009-12-18 19:33 ` Trond Myklebust
2009-12-18 20:14 ` Jeff Layton
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=1261144574-1642-1-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=trond.myklebust@netapp.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