Commit 26efd79
ftrace: Fix possible warning on checking all pages used in ftrace_process_locs()
As comments in ftrace_process_locs(), there may be NULL pointers in
mcount_loc section:
> Some architecture linkers will pad between
> the different mcount_loc sections of different
> object files to satisfy alignments.
> Skip any NULL pointers.
After commit 20e5227 ("ftrace: allow NULL pointers in mcount_loc"),
NULL pointers will be accounted when allocating ftrace pages but skipped
before adding into ftrace pages, this may result in some pages not being
used. Then after commit 706c81f ("ftrace: Remove extra helper
functions"), warning may occur at:
WARN_ON(pg->next);
To fix it, only warn for case that no pointers skipped but pages not used
up, then free those unused pages after releasing ftrace_lock.
Link: https://lore.kernel.org/linux-trace-kernel/20230712060452.3175675-1-zhengyejian1@huawei.com
Cc: stable@vger.kernel.org
Fixes: 706c81f ("ftrace: Remove extra helper functions")
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>1 parent 7e42907 commit 26efd79
1 file changed
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3305 | 3305 | | |
3306 | 3306 | | |
3307 | 3307 | | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
3308 | 3324 | | |
3309 | 3325 | | |
3310 | 3326 | | |
| |||
3343 | 3359 | | |
3344 | 3360 | | |
3345 | 3361 | | |
3346 | | - | |
3347 | | - | |
3348 | | - | |
3349 | | - | |
3350 | | - | |
3351 | | - | |
3352 | | - | |
3353 | | - | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
| 3362 | + | |
3357 | 3363 | | |
3358 | 3364 | | |
3359 | 3365 | | |
| |||
6471 | 6477 | | |
6472 | 6478 | | |
6473 | 6479 | | |
| 6480 | + | |
6474 | 6481 | | |
6475 | 6482 | | |
6476 | 6483 | | |
| 6484 | + | |
6477 | 6485 | | |
6478 | 6486 | | |
6479 | 6487 | | |
| |||
6536 | 6544 | | |
6537 | 6545 | | |
6538 | 6546 | | |
6539 | | - | |
| 6547 | + | |
| 6548 | + | |
6540 | 6549 | | |
| 6550 | + | |
6541 | 6551 | | |
6542 | 6552 | | |
6543 | 6553 | | |
| |||
6551 | 6561 | | |
6552 | 6562 | | |
6553 | 6563 | | |
6554 | | - | |
6555 | | - | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
| 6567 | + | |
6556 | 6568 | | |
6557 | 6569 | | |
6558 | 6570 | | |
| |||
6574 | 6586 | | |
6575 | 6587 | | |
6576 | 6588 | | |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
6577 | 6594 | | |
6578 | 6595 | | |
6579 | 6596 | | |
| |||
0 commit comments