Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 486bad2e authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust
Browse files

sunrpc: on successful gss error pipe write, don't return error



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. In the event of other
errors, we generally want the initiating task to retry the upcall so
we set msg.errno to -EAGAIN. An unexpected error code here is a bug
however, so BUG() in that case.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Cc: stable@kernel.org
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b891e4a0
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -644,7 +644,22 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
	p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
	p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
	if (IS_ERR(p)) {
	if (IS_ERR(p)) {
		err = PTR_ERR(p);
		err = PTR_ERR(p);
		gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
		switch (err) {
		case -EACCES:
			gss_msg->msg.errno = err;
			err = mlen;
			break;
		case -EFAULT:
		case -ENOMEM:
		case -EINVAL:
		case -ENOSYS:
			gss_msg->msg.errno = -EAGAIN;
			break;
		default:
			printk(KERN_CRIT "%s: bad return from "
				"gss_fill_context: %ld\n", __func__, err);
			BUG();
		}
		goto err_release_msg;
		goto err_release_msg;
	}
	}
	gss_msg->ctx = gss_get_ctx(ctx);
	gss_msg->ctx = gss_get_ctx(ctx);