diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 6d4995a5f318..c34f0eee5d07 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -17,6 +17,7 @@ #include #include #include +#include "../../kernel/printk/internal.h" #define MIN_TTYB_SIZE 256 @@ -156,6 +157,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) { struct llist_node *free; struct tty_buffer *p; + unsigned long flags; /* Round the buffer size out */ size = __ALIGN_MASK(size, TTYB_ALIGN_MASK); @@ -172,7 +174,9 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) have queued and recycle that ? */ if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit) return NULL; - p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); + printk_safe_enter_irqsave(flags); + p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC | __GFP_NOWARN); + printk_safe_exit_irqrestore(flags); if (p == NULL) return NULL;