From: Wang YanQing <udknight@gmail.com>
To: gregkh@linuxfoundation.org
Cc: jslaby@suse.com, linux-kernel@vger.kernel.org, mikey@neuling.org,
viro@ZenIV.linux.org.uk, johan@kernel.org,
peter@hurleysoftware.com, alex.popov@linux.com, robh@kernel.org,
mpatocka@redhat.com, dvyukov@google.com,
benh@kernel.crashing.org
Subject: [PATCH] tty:tty_ldisc: add tty_ldisc_lock|unlock to prevent concurrent update to ldisc in tty_ldisc_deinit
Date: Mon, 10 Apr 2017 00:59:03 +0800 [thread overview]
Message-ID: <20170409165903.GA9643@udknight> (raw)
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@gmail.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
next reply other threads:[~2017-04-09 17:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 16:59 Wang YanQing [this message]
2017-04-10 0:33 ` [PATCH] tty:tty_ldisc: add tty_ldisc_lock|unlock to prevent concurrent update to ldisc in tty_ldisc_deinit Michael Neuling
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=20170409165903.GA9643@udknight \
--to=udknight@gmail.com \
--cc=alex.popov@linux.com \
--cc=benh@kernel.crashing.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikey@neuling.org \
--cc=mpatocka@redhat.com \
--cc=peter@hurleysoftware.com \
--cc=robh@kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.