From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B939C43381 for ; Sat, 30 Mar 2019 08:24:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D194B218AC for ; Sat, 30 Mar 2019 08:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553934261; bh=AHDb/JdrXsKf70FPBki5fUYMKrDNp0kv9xfILovc2JI=; h=Subject:To:From:Date:List-ID:From; b=M+H/AqkHkebyp1Tm54I/1mRiUAA6v3iHxECfzPrJegS6I+fN++4746AZoRlG6vg7X bGsZUzB+RecUZYy96lYasiXu2OPMmr/CBi4FzO1Z4ol+kjH1reYpzSG4/heVLVzEMC B723Ny5IdDF1wxjpjH4B/XkPtgGplk0LRcMK7L7A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730331AbfC3IYV (ORCPT ); Sat, 30 Mar 2019 04:24:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:60816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726450AbfC3IYV (ORCPT ); Sat, 30 Mar 2019 04:24:21 -0400 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72D892173C; Sat, 30 Mar 2019 08:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553934260; bh=AHDb/JdrXsKf70FPBki5fUYMKrDNp0kv9xfILovc2JI=; h=Subject:To:From:Date:From; b=tRGjxTKlF3k87u21uquElW+VD4f0uI7lLHlTEz2HLGkGAbzSPfkrxDSwZCPJeyvps d8yvvLS7DJ5IrmqkCABA/1he7ISNKmbqsvH4XksH3iMVBwXM3HVpzO7pj9CcVyxuxD LFF1hFONAr+MCgTl07aZMYBVFsO/GivalMYsuhnk= Subject: patch "Revert "tty: pty: Fix race condition between release_one_tty and" added to tty-next To: gregkh@linuxfoundation.org, keun-o.park@darkmatter.ae, lkp@intel.com, stable@vger.kernel.org From: Date: Sat, 30 Mar 2019 09:23:16 +0100 Message-ID: <155393419682118@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled Revert "tty: pty: Fix race condition between release_one_tty and to my tty git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git in the tty-next branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will also be merged in the next major kernel release during the merge window. If you have any questions about this process, please let me know. >From 0eae4686a128d87503863a261e84887750c8bc68 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 29 Mar 2019 15:47:40 +0100 Subject: Revert "tty: pty: Fix race condition between release_one_tty and pty_write" This reverts commit b9ca5f8560af244489b4a1bc1ae88b341f24bc95 as 0-day shows it has a circular locking dependency. Fixes: b9ca5f8560af ("tty: pty: Fix race condition between release_one_tty and pty_write") Reported-by: kernel test robot Cc: Sahara Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/pty.c | 7 ------- drivers/tty/tty_io.c | 3 --- 2 files changed, 10 deletions(-) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index ef72031ab5b9..00099a8439d2 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -116,12 +116,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) if (tty->stopped) return 0; - mutex_lock(&tty_mutex); - if (to->magic != TTY_MAGIC) { - mutex_unlock(&tty_mutex); - return -EIO; - } - if (c > 0) { spin_lock_irqsave(&to->port->lock, flags); /* Stuff the data into the input queue of the other end */ @@ -131,7 +125,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) tty_flip_buffer_push(to->port); spin_unlock_irqrestore(&to->port->lock, flags); } - mutex_unlock(&tty_mutex); return c; } diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index c27777f3b8c4..5fa250157025 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -1448,13 +1448,10 @@ static void release_one_tty(struct work_struct *work) struct tty_driver *driver = tty->driver; struct module *owner = driver->owner; - mutex_lock(&tty_mutex); if (tty->ops->cleanup) tty->ops->cleanup(tty); tty->magic = 0; - mutex_unlock(&tty_mutex); - tty_driver_kref_put(driver); module_put(owner); -- 2.21.0