Skip to content

Commit 61cc70d

Browse files
Jakob-Koschelgregkh
authored andcommitted
vt_ioctl: fix array_index_nospec in vt_setactivate
array_index_nospec ensures that an out-of-bounds value is set to zero on the transient path. Decreasing the value by one afterwards causes a transient integer underflow. vsa.console should be decreased first and then sanitized with array_index_nospec. Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU Amsterdam. Co-developed-by: Brian Johannesmeyer <[email protected]> Signed-off-by: Brian Johannesmeyer <[email protected]> Signed-off-by: Jakob Koschel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5d5ead5 commit 61cc70d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/vt/vt_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ static int vt_setactivate(struct vt_setactivate __user *sa)
599599
if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
600600
return -ENXIO;
601601

602-
vsa.console = array_index_nospec(vsa.console, MAX_NR_CONSOLES + 1);
603602
vsa.console--;
603+
vsa.console = array_index_nospec(vsa.console, MAX_NR_CONSOLES);
604604
console_lock();
605605
ret = vc_allocate(vsa.console);
606606
if (ret) {

0 commit comments

Comments
 (0)