Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3311207imu; Sun, 11 Nov 2018 12:07:23 -0800 (PST) X-Google-Smtp-Source: AJdET5eT6T1GLmvTP/Y0RHgZaCjZLtXiUzUZ5SxpLiU31F627J9GqoYVBSx/MhTgA4NUAjeV/hK2 X-Received: by 2002:a17:902:703:: with SMTP id 3-v6mr17444807pli.38.1541966843807; Sun, 11 Nov 2018 12:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966843; cv=none; d=google.com; s=arc-20160816; b=sfw6cc0tszcr3fGBbHwIi1O9sUQWEivOpBKa1Acr+KlanrEZlECEWL32DUngkgFGks ug7PnNUnq1MuWGNwIhZDK3QyuDO7EebtVYp9CURsa2dlqw2a8MrpCWLIjNqEYX0W7Mck CXsYUzh3WlMJ7D/+5HxXNPxbFDS7lx4eMqdYCjyqKaIbh+X3XbEgKwhyp5j5efW//eTS v1D9OfRTaatRIxW4hvOhl7aEMaF6JxAI6lXeJx6lPWlbCna84Pj3m2+TzsahdIitHsWG jsKk0Q9soqE4SARz8pH2Kd2FVSrGXQtENeqPQ+uiAEtWeAbOQe1MFDvcsuyLT4o9JFo+ xsvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=wxhb2wjXhPSL28k9vz/o8iWzUjeXihJGp6qRiTI7pyA=; b=ppspT80jRX+lw4P3V2LDUFlBU19IDZshPhCd77RE6r8ffh916n3CknHQF+mznH+6aN LFQSoeSdRKGevhxWKAB4c9QMFpty/AqacQyFbwfNaKmgI7mfkMexie514awybZWJB2sD as8Gf0/0ttxDmXkSca9l0fJf86jF9C6424fonPI+9fSwbxiaA1GDauJfukmjQK5Nf/QV gVumkrP9Qe0OllLOzSm++05vSG4s/jJenfpMosNwKPS4ffqU4TZGvJl+X+EVyGNDLPLr sC4BIrQzUgOkDwWncQ3Y4zskHBxtiJBEmog1QP/xFSfX2Za3NTVtc8/uIfZw18Iid+8a qWyg== ARC-Authentication-Results: i=1; mx.google.com; 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 r2-v6si13209013pgj.139.2018.11.11.12.07.08; Sun, 11 Nov 2018 12:07:23 -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; 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 S1731378AbeKLF4L (ORCPT + 99 others); Mon, 12 Nov 2018 00:56:11 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52006 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728613AbeKLF4L (ORCPT ); Mon, 12 Nov 2018 00:56:11 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsv-0000l9-CG; Sun, 11 Nov 2018 19:59:05 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsU-0001eb-Ur; Sun, 11 Nov 2018 19:58:38 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jiri Slaby" , "Fugang Duan" , "Greg Kroah-Hartman" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 211/366] tty: vt, remove reduntant check In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Slaby commit 182846a00f489849c55d113954f0c4a8a286ca39 upstream. MAX_NR_CONSOLES and MAX_NR_USER_CONSOLES are both 63 since they were introduced in 1.1.54. And since vc_allocate does: if (currcons >= MAX_NR_CONSOLES) return -ENXIO; if (!vc_cons[currcons].d) { if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE)) return -EPERM; } the second check is pointless. Remove both the check and the macro MAX_NR_USER_CONSOLES. Signed-off-by: Jiri Slaby Reported-by: Fugang Duan Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/tty/vt/vt.c | 4 ---- include/uapi/linux/vt.h | 1 - 2 files changed, 5 deletions(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -760,10 +760,6 @@ int vc_allocate(unsigned int currcons) / struct vc_data *vc; struct vt_notifier_param param; - /* prevent users from taking too much memory */ - if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE)) - return -EPERM; - /* due to the granularity of kmalloc, we waste some memory here */ /* the alloc is done in two steps, to optimize the common situation of a 25x80 console (structsize=216, screenbuf_size=4000) */ --- a/include/uapi/linux/vt.h +++ b/include/uapi/linux/vt.h @@ -8,7 +8,6 @@ */ #define MIN_NR_CONSOLES 1 /* must be at least 1 */ #define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ -#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */ /* Note: the ioctl VT_GETSTATE does not work for consoles 16 and higher (since it returns a short) */