提交 61cc70d9 编写于 作者: J Jakob Koschel 提交者: Greg Kroah-Hartman

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: NBrian Johannesmeyer <bjohannesmeyer@gmail.com>
Signed-off-by: NBrian Johannesmeyer <bjohannesmeyer@gmail.com>
Signed-off-by: NJakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220127144406.3589293-1-jakobkoschel@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 5d5ead5e
...@@ -599,8 +599,8 @@ static int vt_setactivate(struct vt_setactivate __user *sa) ...@@ -599,8 +599,8 @@ static int vt_setactivate(struct vt_setactivate __user *sa)
if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
return -ENXIO; return -ENXIO;
vsa.console = array_index_nospec(vsa.console, MAX_NR_CONSOLES + 1);
vsa.console--; vsa.console--;
vsa.console = array_index_nospec(vsa.console, MAX_NR_CONSOLES);
console_lock(); console_lock();
ret = vc_allocate(vsa.console); ret = vc_allocate(vsa.console);
if (ret) { if (ret) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册