On Tue, 13 Feb 2024 16:50:31 +0100
Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com> wrote:

> @@ -1503,6 +1504,24 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>               drm_mode_object_put(obj);
>       }
>  
> +     if (trace_drm_mode_atomic_commit_enabled()) {
> +             struct drm_crtc_state *crtc_state;
> +             struct drm_crtc *crtc;
> +             int *crtcs;
> +             int i, num_crtcs;
> +
> +             crtcs = kcalloc(dev->mode_config.num_crtc, sizeof(int),
> +                             GFP_KERNEL);

If the above allocation fails, this will cause a NULL kernel dereference.

-- Steve

> +
> +             num_crtcs = 0;
> +             for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> +                     crtcs[num_crtcs++] = drm_crtc_index(crtc);
> +
> +             trace_drm_mode_atomic_commit(file_priv, crtcs, num_crtcs, 
> arg->flags);
> +
> +             kfree(crtcs);
> +     }
> +
>       ret = prepare_signaling(dev, state, arg, file_priv, &fence_state,
>                               &num_fences);
>       if (ret)

Reply via email to