On Thu, Nov 17, 2016 at 06:03:48PM -0800, Dhinakaran Pandiyan wrote:
>  static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,
>                           struct drm_dp_vcpi *vcpi, int pbn)
>  {
> -     int num_slots;
> +     int req_slots;
>       int ret;
>  
> -     num_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> +     req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
>  
> -     if (num_slots > mgr->avail_slots)
> -             return -ENOSPC;
> +     mutex_lock(&mgr->lock);
> +     if (req_slots > mgr->avail_slots) {
> +             ret = -ENOSPC;
> +             goto out;
> +     }

You are not atomically reducing the mgr->avail_slots, leading to
possible overallocation of multiple streams?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

Reply via email to