diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-11-14 10:48:05 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-11-15 07:40:32 -0500 |
commit | 621eb19ce1ec216e03ad354cb0c4061736b2a436 (patch) | |
tree | 57767888ba129e174a61398451a8ad405fd2028a /include/linux/sunrpc | |
parent | 2b4cf668a7b8f84182a35f07152d8b6f012629d2 (diff) |
svcrpc: Revert "sunrpc/cache.h: replace simple_strtoul"
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.
Cc: stable@vger.kernel.org
Reported-by: Sven Geggus <lists@fuchsschwanzdomain.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/cache.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index f792794f6634..5dc9ee4d616e 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
@@ -217,6 +217,8 @@ extern int qword_get(char **bpp, char *dest, int bufsize); | |||
217 | static inline int get_int(char **bpp, int *anint) | 217 | static inline int get_int(char **bpp, int *anint) |
218 | { | 218 | { |
219 | char buf[50]; | 219 | char buf[50]; |
220 | char *ep; | ||
221 | int rv; | ||
220 | int len = qword_get(bpp, buf, sizeof(buf)); | 222 | int len = qword_get(bpp, buf, sizeof(buf)); |
221 | 223 | ||
222 | if (len < 0) | 224 | if (len < 0) |
@@ -224,9 +226,11 @@ static inline int get_int(char **bpp, int *anint) | |||
224 | if (len == 0) | 226 | if (len == 0) |
225 | return -ENOENT; | 227 | return -ENOENT; |
226 | 228 | ||
227 | if (kstrtoint(buf, 0, anint)) | 229 | rv = simple_strtol(buf, &ep, 0); |
230 | if (*ep) | ||
228 | return -EINVAL; | 231 | return -EINVAL; |
229 | 232 | ||
233 | *anint = rv; | ||
230 | return 0; | 234 | return 0; |
231 | } | 235 | } |
232 | 236 | ||