n_gsm: Use array_index_nospec() with index that comes from userspace
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 11 Apr 2023 16:45:32 +0000 (19:45 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 12:11:33 +0000 (14:11 +0200)
commit2b3174c96696cde676393474f0e01d0d108462f5
treea81a0ae7a4f0ff1c08bff6d31c0d621653f6e39a
parentf91cf1a30255d81cf1d8992974ec0a9c0fd4a771
n_gsm: Use array_index_nospec() with index that comes from userspace

dc.channel used for indexing comes directly from copy_from_user(). Use
array_index_nospec() to mitigate speculative side-channel.

Link: https://lore.kernel.org/linux-serial/64306d13.ONswMlyWlVKLGkKR%25lkp@intel.com/
Cc: stable <stable@kernel.org>
Fixes: afe3154ba87e ("tty: n_gsm: add ioctl for DLC config via ldisc handle")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Daniel Starke <daniel.starke@siemens.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230411164532.64175-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_gsm.c