Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4565045imu; Tue, 29 Jan 2019 03:54:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KcB7hC+oqefdv52BE9yIkoQx2QtHxJaDQApGr8cENvBfvpLZ7k9NbpeiLdDi+ntX56FF2 X-Received: by 2002:a62:f907:: with SMTP id o7mr25476375pfh.244.1548762891222; Tue, 29 Jan 2019 03:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548762891; cv=none; d=google.com; s=arc-20160816; b=C3TRNRqlWerfkSMl8ybuM2BQF75mvuZxQVGLWOu2XSzzNABZrp57U+MtLG1QjT2T11 dsJkLSCv6qrNgcpjvoVEarN435EAxO9s4ZeDtqqLZ9SzLU4mVdYaI1vUdQkrSje1UENS 3JuHMDcxO2HZtzt0y4YCuaqnzPaYS9ihih9DeV0/Ic+cbDwZcUNc0aDUaakgUbh2SPxB Xp0FHJm7QIkKg2G+l6is05RAzPvw/ohfjoBl/ZCmW8vq+Xxesp/OktCCTIZ388l7akro YbpvfVh4JkcwdLa3HZR8sqceDu+hvc6YTVcYm8MuR/0GLaVeeqNG8lFEPRC499v8LZtQ Gmbw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e90aZzfGxoOml0K8zH6E6pbz1a/dwFkH0NWFg0DCmFU=; b=kz38sApDlBrSMj+oKmbIGbsxKdeSFved16J6pJ1VDPyGwmWhcv3CEJZjYMmR7oNhaS f02iaCcxjXmz2ud1/Yt85s3w40GmVsLtijEW3a+guiHZSg1fHDF7fnFq9uY3UHBqLUrW Ig1vavSQMixiQHXuRAKmzImy6FAS3HPHbpYIF4zJ3/QPxC1HStmbvsWQ8oZ19oYp+X4G i4JXqZBI9ITWzvGBB6c6RfhnshfuiT0fWdwNn4qXg6TLlIigko8XB7pcEQESDhqZGWOK MZiNpc3bKQ7Nu7h5FbY4LHpmgAQKos8wU1ZC6mCkDJJue6W0/pP6ci+BXCf7tLeqDlWs lGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xuc4N+Wc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si36362700pld.121.2019.01.29.03.54.36; Tue, 29 Jan 2019 03:54:51 -0800 (PST) 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=@kernel.org header.s=default header.b=xuc4N+Wc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732120AbfA2Lwf (ORCPT + 99 others); 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; }