mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
drm/nouveau: Validate channel indices passed from userspace.
When hacking the libdrm for improvements, I triggered a kernel crash related to the fact that the NOUVEAU_NOTIFIEROBJ_ALLOC ioctl calls nouveau_channel_get with an unchecked channel index. The patch ensures that the channel index is an unsigned and validates its value in nouveau_channel_get. Signed-off-by: Michel Hermier <[email protected]> Signed-off-by: Francisco Jerez <[email protected]> Signed-off-by: Ben Skeggs <[email protected]>
This commit is contained in:
parent
c42988012a
commit
8e91182bbd
1 changed files with 3 additions and 0 deletions
|
|
@ -253,6 +253,9 @@ nouveau_channel_get(struct drm_device *dev, struct drm_file *file_priv, int id)
|
|||
struct nouveau_channel *chan;
|
||||
unsigned long flags;
|
||||
|
||||
if (unlikely(id < 0 || id >= NOUVEAU_MAX_CHANNEL_NR))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
spin_lock_irqsave(&dev_priv->channels.lock, flags);
|
||||
chan = nouveau_channel_get_unlocked(dev_priv->channels.ptr[id]);
|
||||
spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue