[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170409165903.GA9643@udknight>
Date: Mon, 10 Apr 2017 00:59:03 +0800
From: Wang YanQing <udknight@...il.com>
To: gregkh@...uxfoundation.org
Cc: jslaby@...e.com, linux-kernel@...r.kernel.org, mikey@...ling.org,
viro@...IV.linux.org.uk, johan@...nel.org,
peter@...leysoftware.com, alex.popov@...ux.com, robh@...nel.org,
mpatocka@...hat.com, dvyukov@...gle.com, benh@...nel.crashing.org
Subject: [PATCH] tty:tty_ldisc: add tty_ldisc_lock|unlock to prevent
concurrent update to ldisc in tty_ldisc_deinit
This patch could fix the issue that free_tty_struct in tty_io
calling tty_ldisc_deinit without holding tty->ldisc_sem.
Signed-off-by: Wang YanQing <udknight@...il.com>
---
drivers/tty/tty_ldisc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index b1f7fa5..674421b 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -771,7 +771,9 @@ void tty_ldisc_init(struct tty_struct *tty)
*/
void tty_ldisc_deinit(struct tty_struct *tty)
{
+ tty_ldisc_lock(tty, MAX_SCHEDULE_TIMEOUT);
if (tty->ldisc)
tty_ldisc_put(tty->ldisc);
tty->ldisc = NULL;
+ tty_ldisc_unlock(tty);
}
--
1.8.5.6.2.g3d8a54e.dirty
Powered by blists - more mailing lists