Skip to content

Commit

Permalink
SUNRPC: improve error response to over-size gss credential
Browse files Browse the repository at this point in the history
When the NFS server receives a large gss (kerberos) credential and tries
to pass it up to rpc.svcgssd (which is deprecated), it triggers an
infinite loop in cache_read().

cache_request() always returns -EAGAIN, and this causes a "goto again".

This patch:
 - changes the error to -E2BIG to avoid the infinite loop, and
 - generates a WARN_ONCE when rsi_request first sees an over-sized
   credential.  The warning suggests switching to gssproxy.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196583
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
NeilBrown authored and Chuck Lever committed Sep 3, 2021
1 parent e38b3f2 commit 0c217d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions net/sunrpc/auth_gss/svcauth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ static void rsi_request(struct cache_detail *cd,
qword_addhex(bpp, blen, rsii->in_handle.data, rsii->in_handle.len);
qword_addhex(bpp, blen, rsii->in_token.data, rsii->in_token.len);
(*bpp)[-1] = '\n';
WARN_ONCE(*blen < 0,
"RPCSEC/GSS credential too large - please use gssproxy\n");
}

static int rsi_parse(struct cache_detail *cd,
Expand Down
2 changes: 1 addition & 1 deletion net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ static int cache_request(struct cache_detail *detail,

detail->cache_request(detail, crq->item, &bp, &len);
if (len < 0)
return -EAGAIN;
return -E2BIG;
return PAGE_SIZE - len;
}

Expand Down

0 comments on commit 0c217d5

Please sign in to comment.