Re: NULL dereference OOPS on SysRq-w



Dave Young wrote:
[snip]

I have a fix for the NULL pointer reference BUG, tested on my pc.
---

"m" will be NULL if seq_printf & seq_puts is called from sched_debug_show
Use SEQ_* macros to fix it

Signed-off-by: Dave Young <hidave.darkstar@xxxxxxxxx>

There is actually already a patch out for this which simply hasn't made it upstream yet - Mike Galbraith emailed me with it and it indeed fixes the problem. I hadn't realized his email didn't go to lkml.. otherwise I would have echoed that here to avoid wasting people's time. My apologies.

Cheers,
Dan

===

Here is his message:

From: efault@xxxxxx

Peter's fix didn't make it up-stream.

Subject: sched: fix oops

sched_debug uses SEQ_printf to use printk when the seqfile 'm' is NULL.
Instead of doing that here too; choose to not output the weight tree
to cut back on output.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 89fa32b..353a481 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1643,8 +1643,10 @@ static void print_cfs_stats(struct seq_file *m, int cpu)
for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq)
print_cfs_rq(m, cpu, cfs_rq);

- seq_printf(m, "\nWeight tree:\n");
- print_cfs_rq_tasks(m, &cpu_rq(cpu)->cfs, 1);
+ if (m) {
+ seq_printf(m, "\nWeight tree:\n");
+ print_cfs_rq_tasks(m, &cpu_rq(cpu)->cfs, 1);
+ }
rcu_read_unlock();
}
#endif


--
/--------------- - - - - - -
| Dan Noe
| http://isomerica.net/~dpn/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH 06/14] DRBD: userspace_interface
    ... help you fix a lot of codingstyle quirks that tend to annoy ordinary ... codingstyle encourages ALL_CAPS. ... Please use the existing dev_warn-style macros instead of writing ... +#undef M_ADDR ...
    (Linux-Kernel)
  • Re: How do I make my own custom C compiler?
    ... to fix a bug. ... Macros everywhere hide from you what is going on. ... has been taken to ridiculous extremes (the assembler, ... For instance I am trying to understand the way gcc generates the ...
    (comp.lang.c)
  • Re: Office 2004 - Student and Teacher Edition - and Endnote 8.0
    ... though someone here told me how to fix it. ... When you reinstalled Office, did you do a default or custom install? ... Is it installed in your base applications folder (hard drive/apps) or in the ... I suspect Bookends also works by means of macros, ...
    (microsoft.public.mac.office.word)
  • Re: exit sub not working
    ... I see what you're doing and yes, very very messy, heh. ... What you could do is specify the error number in your On.Error to match the ... Why can't you fix this at source and take out the "stop all macros" thing ...
    (microsoft.public.access.macros)
  • Re: hci_usb: remove macro code obfuscation
    ... I had trouble figuring out what the code does. ... management is actually pretty simple, ... with macros. ... Fix that. ...
    (Linux-Kernel)