tty: vt, remove reduntant check
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 <jslaby@suse.cz>
Reported-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b8995f527a
commit
182846a00f
@@ -768,10 +768,6 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
|
|||||||
struct vc_data *vc;
|
struct vc_data *vc;
|
||||||
struct vt_notifier_param param;
|
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 */
|
/* due to the granularity of kmalloc, we waste some memory here */
|
||||||
/* the alloc is done in two steps, to optimize the common situation
|
/* the alloc is done in two steps, to optimize the common situation
|
||||||
of a 25x80 console (structsize=216, screenbuf_size=4000) */
|
of a 25x80 console (structsize=216, screenbuf_size=4000) */
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
|
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
|
||||||
#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
|
#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
|
/* Note: the ioctl VT_GETSTATE does not work for
|
||||||
consoles 16 and higher (since it returns a short) */
|
consoles 16 and higher (since it returns a short) */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user