From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f67.google.com ([209.85.208.67]:40551 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725199AbeH2GS1 (ORCPT ); Wed, 29 Aug 2018 02:18:27 -0400 Received: by mail-ed1-f67.google.com with SMTP id e19-v6so2774696edq.7 for ; Tue, 28 Aug 2018 19:23:55 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Daniel Axtens , Dmitry Vyukov , Michael Neuling , Mikulas Patocka , =?UTF-8?q?Pasi=20K=C3=A4rkk=C3=A4inen?= , Peter Hurley , Sergey Senozhatsky , Tan Xiaojun , Greg Kroah-Hartman , Jiri Slaby , stable@vger.kernel.org Subject: [PATCH 0/4] tty: Hold write ldisc sem in tty_reopen() Date: Wed, 29 Aug 2018 03:23:49 +0100 Message-Id: <20180829022353.23568-1-dima@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: Two fixes for potential and real issues. Looks worth to have in stables as we've hit it on v4.9 stable. And for linux-next - adding lockdep asserts for line discipline changing code, verifying that write ldisc sem will be held forthwith. I couldn't verify that holding write lock fixes the issue as we've hit it only once and I've failed in reproducing it. But searching in lkml, Cc'ing here people who probably had the same crash (and in hope someone of them could give tested-by): Cc: Daniel Axtens Cc: Dmitry Vyukov Cc: Michael Neuling Cc: Mikulas Patocka Cc: Pasi Kärkkäinen Cc: Peter Hurley Cc: Sergey Senozhatsky Cc: Tan Xiaojun (please, ignore if I Cc'ed you mistakenly) Dmitry Safonov (4): tty: Drop tty->count on tty_reopen() failure tty: Hold tty_ldisc_lock() during tty_reopen() tty: Lock tty pair in tty_init_dev() tty/lockdep: Add ldisc_sem asserts drivers/tty/tty_io.c | 21 +++++++++++++++------ drivers/tty/tty_ldisc.c | 12 ++++++++---- include/linux/tty.h | 4 ++++ 3 files changed, 27 insertions(+), 10 deletions(-) -- 2.13.6