From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Pin pages whilst allocating for dma-buf vmap() Date: Fri, 29 Nov 2013 15:00:43 +0100 Message-ID: <20131129140043.GX27344@phenom.ffwll.local> References: <1385725499-9342-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com [209.85.215.180]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C00CFB16A for ; Fri, 29 Nov 2013 06:00:00 -0800 (PST) Received: by mail-ea0-f180.google.com with SMTP id f15so6734650eak.25 for ; Fri, 29 Nov 2013 05:59:59 -0800 (PST) Content-Disposition: inline In-Reply-To: <1385725499-9342-1-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Nov 29, 2013 at 11:44:59AM +0000, Chris Wilson wrote: > During the vmap() routine for the dma-buf, we first grab the pages and > then try to allocate a temporary array to pass to the vmap(). However, > the shrinker can and will reap any object that is unbound if the > allocation for the array first fails. This includes the object which we > are attempting to vmap(). The solution is to mark the object's pages as > pinned whilst we try the allocation to prevent the use-after-free > introduced by the potential shrinkage. > > Signed-off-by: Chris Wilson Picked up for -fixes, thanks for the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch