aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug3
-rw-r--r--lib/idr.c4
-rw-r--r--lib/iov_iter.c6
-rw-r--r--lib/kobject_uevent.c49
-rw-r--r--lib/lz4/lz4_decompress.c4
-rw-r--r--lib/ratelimit.c4
-rw-r--r--lib/rhashtable.c9
7 files changed, 59 insertions, 20 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b19c491cbc4e..2689b7c50c52 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -219,7 +219,8 @@ config FRAME_WARN
219 range 0 8192 219 range 0 8192
220 default 0 if KASAN 220 default 0 if KASAN
221 default 2048 if GCC_PLUGIN_LATENT_ENTROPY 221 default 2048 if GCC_PLUGIN_LATENT_ENTROPY
222 default 1024 if !64BIT 222 default 1280 if (!64BIT && PARISC)
223 default 1024 if (!64BIT && !PARISC)
223 default 2048 if 64BIT 224 default 2048 if 64BIT
224 help 225 help
225 Tell gcc to warn at build time for stack frames larger than this. 226 Tell gcc to warn at build time for stack frames larger than this.
diff --git a/lib/idr.c b/lib/idr.c
index f9adf4805fd7..edd9b2be1651 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -146,8 +146,8 @@ EXPORT_SYMBOL(idr_get_next_ext);
146 * idr_alloc() and idr_remove() (as long as the ID being removed is not 146 * idr_alloc() and idr_remove() (as long as the ID being removed is not
147 * the one being replaced!). 147 * the one being replaced!).
148 * 148 *
149 * Returns: 0 on success. %-ENOENT indicates that @id was not found. 149 * Returns: the old value on success. %-ENOENT indicates that @id was not
150 * %-EINVAL indicates that @id or @ptr were not valid. 150 * found. %-EINVAL indicates that @id or @ptr were not valid.
151 */ 151 */
152void *idr_replace(struct idr *idr, void *ptr, int id) 152void *idr_replace(struct idr *idr, void *ptr, int id)
153{ 153{
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 52c8dd6d8e82..1c1c06ddc20a 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -687,8 +687,10 @@ EXPORT_SYMBOL(_copy_from_iter_full_nocache);
687 687
688static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) 688static inline bool page_copy_sane(struct page *page, size_t offset, size_t n)
689{ 689{
690 size_t v = n + offset; 690 struct page *head = compound_head(page);
691 if (likely(n <= v && v <= (PAGE_SIZE << compound_order(page)))) 691 size_t v = n + offset + page_address(page) - page_address(head);
692
693 if (likely(n <= v && v <= (PAGE_SIZE << compound_order(head))))
692 return true; 694 return true;
693 WARN_ON(1); 695 WARN_ON(1);
694 return false; 696 return false;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index e590523ea476..f237a09a5862 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -294,6 +294,26 @@ static void cleanup_uevent_env(struct subprocess_info *info)
294} 294}
295#endif 295#endif
296 296
297static void zap_modalias_env(struct kobj_uevent_env *env)
298{
299 static const char modalias_prefix[] = "MODALIAS=";
300 int i;
301
302 for (i = 0; i < env->envp_idx;) {
303 if (strncmp(env->envp[i], modalias_prefix,
304 sizeof(modalias_prefix) - 1)) {
305 i++;
306 continue;
307 }
308
309 if (i != env->envp_idx - 1)
310 memmove(&env->envp[i], &env->envp[i + 1],
311 sizeof(env->envp[i]) * env->envp_idx - 1);
312
313 env->envp_idx--;
314 }
315}
316
297/** 317/**
298 * kobject_uevent_env - send an uevent with environmental data 318 * kobject_uevent_env - send an uevent with environmental data
299 * 319 *
@@ -409,16 +429,29 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
409 } 429 }
410 } 430 }
411 431
412 /* 432 switch (action) {
413 * Mark "add" and "remove" events in the object to ensure proper 433 case KOBJ_ADD:
414 * events to userspace during automatic cleanup. If the object did 434 /*
415 * send an "add" event, "remove" will automatically generated by 435 * Mark "add" event so we can make sure we deliver "remove"
416 * the core, if not already done by the caller. 436 * event to userspace during automatic cleanup. If
417 */ 437 * the object did send an "add" event, "remove" will
418 if (action == KOBJ_ADD) 438 * automatically generated by the core, if not already done
439 * by the caller.
440 */
419 kobj->state_add_uevent_sent = 1; 441 kobj->state_add_uevent_sent = 1;
420 else if (action == KOBJ_REMOVE) 442 break;
443
444 case KOBJ_REMOVE:
421 kobj->state_remove_uevent_sent = 1; 445 kobj->state_remove_uevent_sent = 1;
446 break;
447
448 case KOBJ_UNBIND:
449 zap_modalias_env(env);
450 break;
451
452 default:
453 break;
454 }
422 455
423 mutex_lock(&uevent_sock_mutex); 456 mutex_lock(&uevent_sock_mutex);
424 /* we will send an event, so request a new sequence number */ 457 /* we will send an event, so request a new sequence number */
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index bd3574312b82..141734d255e4 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -85,8 +85,8 @@ static FORCE_INLINE int LZ4_decompress_generic(
85 const BYTE * const lowLimit = lowPrefix - dictSize; 85 const BYTE * const lowLimit = lowPrefix - dictSize;
86 86
87 const BYTE * const dictEnd = (const BYTE *)dictStart + dictSize; 87 const BYTE * const dictEnd = (const BYTE *)dictStart + dictSize;
88 const unsigned int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; 88 static const unsigned int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };
89 const int dec64table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; 89 static const int dec64table[] = { 0, 0, 0, -1, 0, 1, 2, 3 };
90 90
91 const int safeDecode = (endOnInput == endOnInputSize); 91 const int safeDecode = (endOnInput == endOnInputSize);
92 const int checkOffset = ((safeDecode) && (dictSize < (int)(64 * KB))); 92 const int checkOffset = ((safeDecode) && (dictSize < (int)(64 * KB)));
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 08f8043cac61..d01f47135239 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -48,7 +48,9 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
48 if (time_is_before_jiffies(rs->begin + rs->interval)) { 48 if (time_is_before_jiffies(rs->begin + rs->interval)) {
49 if (rs->missed) { 49 if (rs->missed) {
50 if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) { 50 if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
51 pr_warn("%s: %d callbacks suppressed\n", func, rs->missed); 51 printk_deferred(KERN_WARNING
52 "%s: %d callbacks suppressed\n",
53 func, rs->missed);
52 rs->missed = 0; 54 rs->missed = 0;
53 } 55 }
54 } 56 }
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 707ca5d677c6..ddd7dde87c3c 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -735,9 +735,9 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_exit);
735 * rhashtable_walk_start - Start a hash table walk 735 * rhashtable_walk_start - Start a hash table walk
736 * @iter: Hash table iterator 736 * @iter: Hash table iterator
737 * 737 *
738 * Start a hash table walk. Note that we take the RCU lock in all 738 * Start a hash table walk at the current iterator position. Note that we take
739 * cases including when we return an error. So you must always call 739 * the RCU lock in all cases including when we return an error. So you must
740 * rhashtable_walk_stop to clean up. 740 * always call rhashtable_walk_stop to clean up.
741 * 741 *
742 * Returns zero if successful. 742 * Returns zero if successful.
743 * 743 *
@@ -846,7 +846,8 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_next);
846 * rhashtable_walk_stop - Finish a hash table walk 846 * rhashtable_walk_stop - Finish a hash table walk
847 * @iter: Hash table iterator 847 * @iter: Hash table iterator
848 * 848 *
849 * Finish a hash table walk. 849 * Finish a hash table walk. Does not reset the iterator to the start of the
850 * hash table.
850 */ 851 */
851void rhashtable_walk_stop(struct rhashtable_iter *iter) 852void rhashtable_walk_stop(struct rhashtable_iter *iter)
852 __releases(RCU) 853 __releases(RCU)