Messages in this thread | | | From | Keith Owens <> | Subject | Re: [PATCH #2] console lock grabbed too early in printk... | Date | Sun, 02 Jul 2000 12:14:38 +1000 |
| |
On Sat, 1 Jul 2000 18:31:12 -0700 (PDT), Chris Lattner <sabre@skylab.org> wrote: >... so this patch adds protection to buf, moves buf into >printk (as a static array), AND allows _SAFE_ recursion by kmalloc'ing a >new buffer if "buf" is in use.
kmalloc(,GFP_KERNEL) in printk is not safe. Lots of code that calls printk is not allowed to sleep which means that printk is never allowed to sleep - kmalloc(,GFP_KERNEL) can sleep. Also kmalloc can call back to printk, unlikely but a possible source of a runaway loop which will blow the kernel stack.
Instead of allocating another buffer, just count how many times you failed because the lock was in use. The code that owns the buffer can issue the original message then check if the lost message counter has changed and issue a message "BUG: <n> printk messages lost". Far safer than calling other kernel services.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |