aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-07-03 21:53:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-07-03 21:53:13 -0400
commit3089f54a7928d28645661c2f3d829e3939d60dd3 (patch)
tree5709fd26998109924da0f2e27154413980b201af /lib
parentef34c6ce49cce8b4d4913fa9166729071f48bab1 (diff)
parent4a3a99045177369700c60d074c0e525e8093b0fc (diff)
Merge tag 'driver-core-3.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH: "Well, one drivercore fix for kernfs to resolve a reported issue with sysfs files being updated from atomic contexts, and another lz4 bugfix for testing potential buffer overflows" * tag 'driver-core-3.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: lz4: add overrun checks to lz4_uncompress_unknownoutputsize() kernfs: kernfs_notify() must be useable from non-sleepable contexts
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4/lz4_decompress.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index b74da447e81e..7a85967060a5 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
192 int s = 255; 192 int s = 255;
193 while ((ip < iend) && (s == 255)) { 193 while ((ip < iend) && (s == 255)) {
194 s = *ip++; 194 s = *ip++;
195 if (unlikely(length > (size_t)(length + s)))
196 goto _output_error;
195 length += s; 197 length += s;
196 } 198 }
197 } 199 }
@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
232 if (length == ML_MASK) { 234 if (length == ML_MASK) {
233 while (ip < iend) { 235 while (ip < iend) {
234 int s = *ip++; 236 int s = *ip++;
237 if (unlikely(length > (size_t)(length + s)))
238 goto _output_error;
235 length += s; 239 length += s;
236 if (s == 255) 240 if (s == 255)
237 continue; 241 continue;
@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
284 288
285 /* write overflow error detected */ 289 /* write overflow error detected */
286_output_error: 290_output_error:
287 return (int) (-(((char *) ip) - source)); 291 return -1;
288} 292}
289 293
290int lz4_decompress(const unsigned char *src, size_t *src_len, 294int lz4_decompress(const unsigned char *src, size_t *src_len,