Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp102537yba; Mon, 20 May 2019 05:45:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2AlDnfp1bbiE+o58ZxmoDyQ7Kt7aWSvR/uK/anf/oAjbmQSn9AVvPjcR2+tSH6+KBtsiZ X-Received: by 2002:a17:902:108a:: with SMTP id c10mr76170672pla.48.1558356318374; Mon, 20 May 2019 05:45:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356318; cv=none; d=google.com; s=arc-20160816; b=VNHk7+Unf3mpcoxSpHaGFvcrmXE/lwKgSjiAa1m5r/ytRtMAgjc4AM6kq1haHEq+SK A8BS4BJCfyPE2FHocwrejMY6lficJMeaMLrr3bjoTbTyth30MvbwsAMqo2Zv7Dj+SGPf +k/8mcZLiInDtASXt14gIcrmfV6vXLltWE/eKz5Pl9rEqH4LnhfP/Sk7bmIW5lJpsONF flsHsZOH7yZ9oU7KGlpB+3ckm4+TQET2kINqHVtY78cl1ThFI4nXHP1auOLBgl+O5h0+ kPVUmAsXWMA0VSsxvmLLSkUWc1vdXmnO0r9q3gxNBCpimKnz6sLaE/BulEGHaVGvOTZs johQ== 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=1JdaKadAJN0+I4JG7qqHQ0NfCtxk7j5Jad57NzG2k3w=; b=k0FtKeHM1nLgbyyXwSsV9g2zDKtF0CgQ/beJH7uztOR8CHV6HoxrQCAXKUecxbuAJy h5nhmwKp39pgrhKsx0ASqk2hzWPP8gviXubgonk6kH4dd4m4HUUAbajrGaBY0xEfWIuh QkGKiJ2YFiO66J0dApT72DxarajDS3Vyvneti/n7rQJnQTCSpmUzYj6KM+C4ya4BtcO0 y7fR8RmpF5F0hhsT4r2M6hL+isCHtkTCK3IiU8olykVFwgIjPeZjXvJBtUec2ssQwTAW DI/Qs3UlHdr9EBXdXDXhxiqWPsAaoqSi71SZqGhzz4xrChwsY85Z2SOiuVzEgWMSbWJ6 dLmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k6cJFJmO; 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 y4si17883547plb.283.2019.05.20.05.45.03; Mon, 20 May 2019 05:45:18 -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=@kernel.org header.s=default header.b=k6cJFJmO; 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 S2389769AbfETM25 (ORCPT + 99 others); Mon, 20 May 2019 08:28:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:44840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389402AbfETM2y (ORCPT ); Mon, 20 May 2019 08:28:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 BC86E2171F; Mon, 20 May 2019 12:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355333; bh=z748kANnPFMpxH387IIMfvA6qz7jBjyQ/TAQcPrR9xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6cJFJmOg69hWqwWSX/1s5enebSAm65/XT8V5h5hQypd1Mp1xnfWIjDWibVs+PpS8 2oScnzySq1YQ4CqoD9CdaBSE1s4TjnRvLxZzV07g5Pw2K8C0mpvUzjJ48SIfteKOZZ 35c6//ziOwnilHMtz0m/D1opUt4G3lj/EQGH/Odc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Pitre , Yifeng Li Subject: [PATCH 5.0 079/123] tty: vt.c: Fix TIOCL_BLANKSCREEN console blanking if blankinterval == 0 Date: Mon, 20 May 2019 14:14:19 +0200 Message-Id: <20190520115250.098679254@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115245.439864225@linuxfoundation.org> References: <20190520115245.439864225@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Yifeng Li commit 75ddbc1fb11efac87b611d48e9802f6fe2bb2163 upstream. Previously, in the userspace, it was possible to use the "setterm" command from util-linux to blank the VT console by default, using the following command. According to the man page, > The force option keeps the screen blank even if a key is pressed. It was implemented by calling TIOCL_BLANKSCREEN. case BLANKSCREEN: ioctlarg = TIOCL_BLANKSCREEN; if (ioctl(STDIN_FILENO, TIOCLINUX, &ioctlarg)) warn(_("cannot force blank")); break; However, after Linux 4.12, this command ceased to work anymore, which is unexpected. By inspecting the kernel source, it shows that the issue was triggered by the side-effect from commit a4199f5eb809 ("tty: Disable default console blanking interval"). The console blanking is implemented by function do_blank_screen() in vt.c: "blank_state" will be initialized to "blank_normal_wait" in con_init() if AND ONLY IF ("blankinterval" > 0). If "blankinterval" is 0, "blank_state" will be "blank_off" (== 0), and a call to do_blank_screen() will always abort, even if a forced blanking is required from the user by calling TIOCL_BLANKSCREEN, the console won't be blanked. This behavior is unexpected from a user's point-of-view, since it's not mentioned in any documentation. The setterm man page suggests it will always work, and the kernel comments in uapi/linux/tiocl.h says > /* keep screen blank even if a key is pressed */ > #define TIOCL_BLANKSCREEN 14 To fix it, we simply remove the "blank_state != blank_off" check, as pointed out by Nicolas Pitre, this check doesn't logically make sense and it's safe to remove. Suggested-by: Nicolas Pitre Fixes: a4199f5eb809 ("tty: Disable default console blanking interval") Signed-off-by: Yifeng Li Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4152,8 +4152,6 @@ void do_blank_screen(int entering_gfx) return; } - if (blank_state != blank_normal_wait) - return; blank_state = blank_off; /* don't blank graphics */