public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Yao HongBo <yaohongbo@huawei.com>
Cc: sergey.senozhatsky@gmail.com, linuxarm@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: possible deadlock in console_unlock
Date: Sat, 16 Feb 2019 16:21:27 +0900	[thread overview]
Message-ID: <20190216072127.GA1945@tigerII.localdomain> (raw)
In-Reply-To: <ebc01f4f-5b1d-4f8a-1d0d-463d5218ee45@huawei.com>

On (02/16/19 14:36), Yao HongBo wrote:
> hi, sergey:
> 
> As shown in that link, https://lkml.org/lkml/2018/6/6/397
> 
> On the linux kernel 5.0-rc6, Syzkaller also hit 'possible deadlock in console_unlock'
> bug for several times in my environment.
> 
> This solution fixes things for me. Do you have a plan to submit patches to
> solve this problem.
> 
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> 	__printk_safe_enter();
> 	kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
> 	__printk_safe_exit();

I would probably try the following:

---

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index ec145a59f199..058d004dcbaa 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -172,7 +172,8 @@ 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);
+	p = kmalloc(sizeof(struct tty_buffer) + 2 * size,
+		    GFP_ATOMIC | __GFP_NOWARN);
 	if (p == NULL)
 		return NULL;
 

  reply	other threads:[~2019-02-16  7:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16  6:36 possible deadlock in console_unlock Yao HongBo
2019-02-16  7:21 ` Sergey Senozhatsky [this message]
2019-02-16  7:46   ` Sergey Senozhatsky
2019-02-16  7:59     ` Yao HongBo
2019-02-18  5:46       ` Sergey Senozhatsky
2019-02-18 12:09         ` Yao HongBo
2019-02-18 14:07         ` Yao HongBo
2019-02-19  1:32           ` Sergey Senozhatsky
2019-02-19  2:48             ` Yao HongBo
  -- strict thread matches above, loose matches on Subject: below --
2018-06-06 13:17 syzbot
2018-06-07  4:44 ` syzbot
2018-06-07  5:10 ` Sergey Senozhatsky
2018-06-07 11:00   ` Petr Mladek
2018-06-07 11:40     ` Tetsuo Handa
2018-06-07 14:03       ` Sergey Senozhatsky
2018-06-07 14:01     ` Sergey Senozhatsky
2018-06-08  8:18       ` Petr Mladek
2018-06-15  8:38         ` Sergey Senozhatsky
2018-06-19  8:04           ` Petr Mladek
2018-06-19  8:08             ` Sergey Senozhatsky
2019-02-20 10:52               ` Tetsuo Handa
2019-11-25  2:41 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190216072127.GA1945@tigerII.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=yaohongbo@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox