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=-5.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH,USER_AGENT_MUTT 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 3D524C4321A for ; Tue, 11 Jun 2019 16:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0601A2089E for ; Tue, 11 Jun 2019 16:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560270305; bh=fyLwDDCECDsj4oxsh4i/Kj8+2jFpP6NlUei1WVffI5s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=u2Kd6o3t+U7bOCPiCr2VZpcpcMdhlVlbTBX3sPCxlcNcrucqcrspDprrT5qK79vm2 pJBnOTzZUEESFonbKLuzjUET3VrNarxVzctu1/2AiBYZ9MSuCZ7WdIAl6+7J3teZjq 13o5SwKx9WW5M649GXmuws1obO3Z9BP6mYhSldKg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391935AbfFKQZE (ORCPT ); Tue, 11 Jun 2019 12:25:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:50348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391933AbfFKQZE (ORCPT ); Tue, 11 Jun 2019 12:25:04 -0400 Received: from localhost (unknown [216.243.17.14]) (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 CB1B52080A; Tue, 11 Jun 2019 16:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560270303; bh=fyLwDDCECDsj4oxsh4i/Kj8+2jFpP6NlUei1WVffI5s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QZFnWxs/TeannM42GwRwiqvKa2VAwBY+2BBZUR/jokIO75+mVozc2L5miQ5hh/5d5 MvMz2+gSmVQGO2Abs+h4MsGYSmNfAgoaE9rmGIfotIZWTmTRl+xvG/RTigdL7+ZhSP LMQbZ3Ev1aP1VqxCWTOo3G0thO+AC58vlh0mceGQ= Date: Tue, 11 Jun 2019 12:25:03 -0400 From: Sasha Levin To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sahara Subject: Re: [PATCH AUTOSEL 4.4 50/56] tty: pty: Fix race condition between release_one_tty and pty_write Message-ID: <20190611162503.GB1513@sasha-vm> References: <20190601132600.27427-1-sashal@kernel.org> <20190601132600.27427-50-sashal@kernel.org> <20190601161707.GC4200@kroah.com> <20190601161836.GD4200@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190601161836.GD4200@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Sat, Jun 01, 2019 at 09:18:36AM -0700, Greg Kroah-Hartman wrote: >On Sat, Jun 01, 2019 at 09:17:07AM -0700, Greg Kroah-Hartman wrote: >> On Sat, Jun 01, 2019 at 09:25:54AM -0400, Sasha Levin wrote: >> > From: Sahara >> > >> > [ Upstream commit b9ca5f8560af244489b4a1bc1ae88b341f24bc95 ] >> > >> > Especially when a linked tty is used such as pty, the linked tty >> > port's buf works have not been cancelled while master tty port's >> > buf work has been cancelled. Since release_one_tty and flush_to_ldisc >> > run in workqueue threads separately, when pty_cleanup happens and >> > link tty port is freed, flush_to_ldisc tries to access freed port >> > and port->itty, eventually it causes a panic. >> > This patch utilizes the magic value with holding the tty_mutex to >> > check if the tty->link is valid. >> > >> > Fixes: 2b022ab7542d ("pty: cancel pty slave port buf's work in tty_release") >> > Signed-off-by: Sahara >> > Cc: stable >> > Signed-off-by: Greg Kroah-Hartman >> > Signed-off-by: Sasha Levin >> > --- >> > drivers/tty/pty.c | 7 +++++++ >> > drivers/tty/tty_io.c | 3 +++ >> > 2 files changed, 10 insertions(+) >> >> For some reason I did not apply this to the stable kernels, and this >> shouldn't only be for 4.4.y, so please drop this. > >Ah, I never applied it because it was later reverted, also upstream, >0eae4686a128 ("Revert "tty: pty: Fix race condition between >release_one_tty and pty_write""), so I didn't apply both of them to the >stable trees as that wouldn't have made sense. I've dropped it. -- Thanks, Sasha