Skip to content

Commit

Permalink
svcrpc: Revert "sunrpc/cache.h: replace simple_strtoul"
Browse files Browse the repository at this point in the history
Commit bbf43dc "sunrpc/cache.h: replace
simple_strtoul" introduced new range-checking which could cause get_int
to fail on unsigned integers too large to be represented as an int.

We could parse them as unsigned instead--but it turns out svcgssd is
actually passing down "-1" in some cases.  Which is perhaps stupid, but
there's nothing we can do about it now.

So just revert back to the previous "sloppy" behavior that accepts
either representation.

Cc: stable@vger.kernel.org
Reported-by: Sven Geggus <lists@fuchsschwanzdomain.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Nov 15, 2012
1 parent 2b4cf66 commit 621eb19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/linux/sunrpc/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,20 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
static inline int get_int(char **bpp, int *anint)
{
char buf[50];
char *ep;
int rv;
int len = qword_get(bpp, buf, sizeof(buf));

if (len < 0)
return -EINVAL;
if (len == 0)
return -ENOENT;

if (kstrtoint(buf, 0, anint))
rv = simple_strtol(buf, &ep, 0);
if (*ep)
return -EINVAL;

*anint = rv;
return 0;
}

Expand Down

0 comments on commit 621eb19

Please sign in to comment.