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=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 B0D6AC282D0 for ; Tue, 29 Jan 2019 11:52:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82C7A20882 for ; Tue, 29 Jan 2019 11:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762757; bh=Am/iAC53N+6DzzW1NJcGiuSetL6AA5uZvNr9mtfvjIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pJj20rm8FO+3/wrz6icO6moB5gO6ngDq/TxYlK0d64ksrrPqlBIpsK0m0yIY+2GEP K5reDoLlvAvt0AyPx2bC7C2IpI10VdyUbLXvwjOj3Hd0mGeD/HOqsi9PAWMsFaKoPr /zfOKb4ZzSQGu9qBsOGOe1QfvZbtrXEy1ZWb50D0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731576AbfA2Lwf (ORCPT ); Tue, 29 Jan 2019 06:52:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:44350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732083AbfA2Lwa (ORCPT ); Tue, 29 Jan 2019 06:52:30 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 7B4A62083B; Tue, 29 Jan 2019 11:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762750; bh=Am/iAC53N+6DzzW1NJcGiuSetL6AA5uZvNr9mtfvjIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuc4N+WcD2dlCQumjViadxOVkZtg9MPyQl01X/XJX/Dyi+BAnLQrBekERabew89ib N6Mu27llx5yjJLqKu43yyLASFo4T4eAUnzZbAT3TbCDxkX8Aex2CB+CeFOATox1bgZ sQJ2c1MUbNhaEDwU+yyms0sLC1alE4qIA/p5zlVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn Subject: [PATCH 4.9 19/44] tty: Handle problem if line discipline does not have receive_buf Date: Tue, 29 Jan 2019 12:36:14 +0100 Message-Id: <20190129113141.526727692@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113139.826927690@linuxfoundation.org> References: <20190129113139.826927690@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 27cfb3a53be46a54ec5e0bd04e51995b74c90343 upstream. Some tty line disciplines do not have a receive buf callback, so properly check for that before calling it. If they do not have this callback, just eat the character quietly, as we can't fail this call. Reported-by: Jann Horn Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2324,7 +2324,8 @@ static int tiocsti(struct tty_struct *tt ld = tty_ldisc_ref_wait(tty); if (!ld) return -EIO; - ld->ops->receive_buf(tty, &ch, &mbz, 1); + if (ld->ops->receive_buf) + ld->ops->receive_buf(tty, &ch, &mbz, 1); tty_ldisc_deref(ld); return 0; }