Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1807951imm; Mon, 3 Sep 2018 09:59:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY7EqVHvrHiEJQuFQ5uu8Ktzi9fKLtK52HOa1MxXzCK9cP4fB3yZKth/NNoGaEmHILiRwhT X-Received: by 2002:a63:3281:: with SMTP id y123-v6mr13294410pgy.310.1535993946899; Mon, 03 Sep 2018 09:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535993946; cv=none; d=google.com; s=arc-20160816; b=wwEb1xoX+feosXofIbrQbJFiGiqhAzj/2OvfvEWZi7jmolBcCm6bF/2ovzOq1grt9V /3ON+ibtji1gbWrS2Fcp7ElVvletDjfmLW2HKTMcXFsjsWgd0Hjhm78w8bxDa9QXq316 EXC+9OGM3XlHHB8Eip9WAoipzFu7Am4Nd6+jTeGJJK+ZKTu7CbTOLyGz59lqleEw3xlV P7GU3RTizXMbULYFF2xH5WHQ8TbOlnl0N4i2WuDEJ0xxKMKKyZn74iQQqCjs8+HD+Bjk 7Em5FeVpvdV1BKKR9zbEwhkhFKZASatAMO0ZDDtHgq8MxAKa7tn0Vw1rLeU9fwXTwJBb E7ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wCAQX/U066t3wgneanUlVYEY20WkU8L8GJUwnaFQMPg=; b=pTe2KLQe9+Rfd8tj8e+C0mZjb0U5Bzjv1nzo8OjMrQ0ABLI2LFDizGLUZ3TTnUS7z+ bQE/hWlAp1PmhGxh4rO3IyFWwTSneBv7RD9fJO11q2OrZ1a7OCAnJbQGYbwLGUfPVFzg IzyOopi8ssqJyuIm7l9/KLZVqNpTfClhVPTR3RN0TLpyUmMy1Z662Br/tP9BUu6/6bJT w9X4nYVtbkv0hoJCd+8nQrF2e9xMTQLknYUTXl6c++8KUT7OMLMbdu9sMnNcil29DTKH KeYn9JkHaJhXTHiksZAhZ6n+AR06YUkhcDMYnJ8QwC/0ZlkwI3lOX7VhO9bePcgkwgNW d09w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=gmCoYTzu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j193-v6si17116861pge.617.2018.09.03.09.58.50; Mon, 03 Sep 2018 09:59:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=gmCoYTzu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728634AbeICVN6 (ORCPT + 99 others); Mon, 3 Sep 2018 17:13:58 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45649 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727803AbeICVN6 (ORCPT ); Mon, 3 Sep 2018 17:13:58 -0400 Received: by mail-ed1-f66.google.com with SMTP id p52-v6so1213351eda.12 for ; Mon, 03 Sep 2018 09:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wCAQX/U066t3wgneanUlVYEY20WkU8L8GJUwnaFQMPg=; b=gmCoYTzuPRPf2cpFV1c1J14jmQicsb8ZLyaDW5OK1/xK0UP7BGiczpdRSz5iGb+Sdc fCUydkNTs/24I4idwTRBoRcUZwr5FlsHPu5cVtoZfQX5bHJt/fTxfeb1kyuSzwKj4//L wo4AEDCBymQ2IYDXIpTbK2+G2CJQda5rk0cl2PWFJVZtSraP5XZMeEwnVBk6/HVe5qXD m5DsfJQrCeXIkTHzeIMmckHXGMiyeNpJ+dwIDwNqsBqE+SVw7T48mmiO/GtFrT1lsPB4 pkSfdD3E7u/LJJxKdv+iRqS7JIYIDdK+0tgtTw0JF0nD5RMcp/NzC8rY8EizLN+BYL6S lasQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wCAQX/U066t3wgneanUlVYEY20WkU8L8GJUwnaFQMPg=; b=SHlcV7xoRxdXUlnb7HO59uebmaK7thXdstHfrjPDvcegL5V3t6g90M54ty8I56KR9I H9yAuN0ymtrjPJAwJ3wTGNQ/IlsxnaZ8lxD1OGfuUf4UGBwBrzwFyPsLXEw5MbTgarPp UheIaQqbTUhjBxzDBkrXqj9fcmkJK8lHBQ4AOJnt3aH9QFHyjRpjvr+VeOSBW683e77O cM8ICo2tJcY0Gh1wH9Zxy/YiqNaXG0phKhoE2k0e0gAhvRqoLEqDujKwETpqeAk3qIKc HZGBs1HyBnIOCWBrMT+frBmPRfN46jMIe/2BmFz4Cxc08szxoHtvxc2f5/zc6uFMcgD6 slkQ== X-Gm-Message-State: APzg51CLz5xuxS+F9lE/uYoQsdEzScX/tMdKyxQYO/n44puMlZiBGuii JeHOkoe8QBmMkkuzJM3kxPxfA97gVnY= X-Received: by 2002:aa7:d391:: with SMTP id x17-v6mr32682044edq.144.1535993579741; Mon, 03 Sep 2018 09:52:59 -0700 (PDT) Received: from dhcp.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id m35-v6sm8085745ede.14.2018.09.03.09.52.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Sep 2018 09:52:59 -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 , Nathan March , =?UTF-8?q?Pasi=20K=C3=A4rkk=C3=A4inen?= , Peter Hurley , Sergey Senozhatsky , Tan Xiaojun , Tetsuo Handa , Greg Kroah-Hartman , Jiri Slaby , stable@vger.kernel.org, Tetsuo Handa , syzbot+3aa9784721dfb90e984d@syzkaller.appspotmail.com Subject: [PATCHv2 0/4] tty: Hold write ldisc sem in tty_reopen() Date: Mon, 3 Sep 2018 17:52:53 +0100 Message-Id: <20180903165257.29227-1-dima@arista.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first two fixes are 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. Changes since v1: - Added tested-by/reported-by tags - Dropped 3/4 (locking tty pair for lockdep sake), Because of that - not adding lockdep_assert_held() in tty_ldisc_open() - Added 4/4 cleanup to inc tty->count only on success of tty_ldisc_reinit() - lock ldisc without (5*HZ) timeout in tty_reopen() v1 link: lkml.kernel.org/r/<20180829022353.23568-1-dima@arista.com> Huuge cc list: Cc: Daniel Axtens Cc: Dmitry Vyukov Cc: Michael Neuling Cc: Mikulas Patocka Cc: Nathan March Cc: Pasi Kärkkäinen Cc: Peter Hurley Cc: Sergey Senozhatsky Cc: Tan Xiaojun Cc: Tetsuo Handa (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/lockdep: Add ldisc_sem asserts tty: Simplify tty->count math in tty_reopen() drivers/tty/tty_io.c | 12 ++++++++---- drivers/tty/tty_ldisc.c | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) -- 2.13.6