]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
svcrpc: Revert "sunrpc/cache.h: replace simple_strtoul"
authorJ. Bruce Fields <bfields@redhat.com>
Wed, 14 Nov 2012 15:48:05 +0000 (10:48 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:46:08 +0000 (08:46 -0800)
commit 621eb19ce1ec216e03ad354cb0c4061736b2a436 upstream.

Commit bbf43dc888833ac0539e437dbaeb28bfd4fbab9f "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.

Reported-by: Sven Geggus <lists@fuchsschwanzdomain.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/sunrpc/cache.h

index f792794f66341a5888136e6697322f445ba62197..5dc9ee4d616e6f966e1b4abe9fe69021f48645ea 100644 (file)
@@ -217,6 +217,8 @@ 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)
@@ -224,9 +226,11 @@ static inline int get_int(char **bpp, int *anint)
        if (len == 0)
                return -ENOENT;
 
-       if (kstrtoint(buf, 0, anint))
+       rv = simple_strtol(buf, &ep, 0);
+       if (*ep)
                return -EINVAL;
 
+       *anint = rv;
        return 0;
 }