-
Notifications
You must be signed in to change notification settings - Fork 106
Fix kernel BUG in apm.c when tfw_apm_global_data is uninitialized (#2424) #2429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic seems good, but need to fix some senseless changes breaking identation
fw/procfs.c
Outdated
unsigned int val[T_PSZ] = { 0 }; | ||
TfwPrcntlStats pstats = {.val = val}; | ||
|
||
if (!ss_stat) | ||
T_WARN("Cannot allocate sync sockets statistics\n"); | ||
T_WARN("Cannot allocate sync sockets statistics\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces in identation, tabs must be used. Please check other places in the PR replacing tabs/spaces
seq_printf(seq, "%02d%%:\t%dms\n", | ||
pstats.ith[i], pstats.val[i]); | ||
|
||
skip_apm: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip_apm: | |
skip_apm: |
And other identation issues
memset(pstats, 0, sizeof(*pstats)); | ||
return -ENODATA; | ||
} | ||
return __tfw_apm_stats(tfw_apm_global_data, pstats); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also identation issues
fw/apm.c
Outdated
BUG_ON(!tfw_apm_global_data); | ||
return __tfw_apm_stats(tfw_apm_global_data, pstats); | ||
if (!tfw_apm_global_data) { | ||
pr_warn("tfw_apm: global data not initialized, skipping stats\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use our logging facilities, e.g. T_WARN()
. But it seems this is a normal case, so maybe we should use T_DBG
instead
This PR fixes a kernel BUG triggered at apm.c:1050 when tfw_apm_global_data is not initialized.
Instead of crashing, the system now gracefully falls back to showing "n/a" for the APM stats in /proc output, similar to how SS statistics are handled.
Fixes: #2424