mirror of
https://github.com/openbsd/src.git
synced 2026-05-01 17:46:35 +00:00
drm/ioc32: stop speculation on the drm_compat_ioctl path
From Greg Kroah-Hartman f0e441be08a2eab10b2d06fccfa267ee599dd6b3 in linux-6.18.y/6.18.22 f8995c2df519f382525ca4bc90553ad2ec611067 in mainline linux
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include <linux/compat.h>
|
||||
#include <linux/nospec.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
@@ -374,6 +375,7 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
if (nr >= ARRAY_SIZE(drm_compat_ioctls))
|
||||
return drm_ioctl(filp, cmd, arg);
|
||||
|
||||
nr = array_index_nospec(nr, ARRAY_SIZE(drm_compat_ioctls));
|
||||
fn = drm_compat_ioctls[nr].fn;
|
||||
if (!fn)
|
||||
return drm_ioctl(filp, cmd, arg);
|
||||
|
||||
Reference in New Issue
Block a user