From patchwork Fri Dec 13 22:23:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22379 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 17F6523FF5 for ; Fri, 13 Dec 2013 22:26:29 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id l109sf4738929yhq.1 for ; Fri, 13 Dec 2013 14:26:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3N+V6X9zovKSAAsCR34BLTCeSsMvNFMRS8QMM1dRKaU=; b=l2VAH8cl/rlHMb4mhRLOVxTFxqGItk9f3jCo7wXWKf9W3Un7+2ZHxk9oM1nZe+Zy+6 p/QJxTRgwquaacon7cZxz0rsrdz2jRuTn6eXxXOk4yC0/GMcznh0cmggnitIpDV74MJB 1+zazfusyYux5+kgBetYfZcFVasvkbtmuKl6iCQzGAqlDiVHp6JmcxGpbZXV8aVd00mq wA2NxvFCH7sSXq9GD5wJ0fochBCsvzAdG1zpQ8BHCVEuBwVBektZdhIcvZVnTdA8wGIj gUXzHXBfxm4X6X24rbz6n2ssylEA6XCL9vWIGgC+SGzeRCbRtXvHKu0e8qVzIkvGMOi4 sbyw== X-Gm-Message-State: ALoCoQnZ8/2zkwEU8qU/nXv4VxNrwMrrvCJvedocxwLcq4Yt/rQS5wjoHB5u+mdiSw5p7WMmOLdj X-Received: by 10.58.249.208 with SMTP id yw16mr1818236vec.10.1386973588887; Fri, 13 Dec 2013 14:26:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.138 with SMTP id k10ls1156635qek.13.gmail; Fri, 13 Dec 2013 14:26:28 -0800 (PST) X-Received: by 10.221.47.193 with SMTP id ut1mr2259836vcb.8.1386973588725; Fri, 13 Dec 2013 14:26:28 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id lw10si1195128vec.81.2013.12.13.14.26.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ie18so1713921vcb.24 for ; Fri, 13 Dec 2013 14:26:28 -0800 (PST) X-Received: by 10.221.49.8 with SMTP id uy8mr1102789vcb.65.1386973588651; Fri, 13 Dec 2013 14:26:28 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp73465vcz; Fri, 13 Dec 2013 14:26:28 -0800 (PST) X-Received: by 10.66.157.167 with SMTP id wn7mr5927795pab.93.1386973587913; Fri, 13 Dec 2013 14:26:27 -0800 (PST) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id wm3si2510958pab.78.2013.12.13.14.26.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id um1so3147753pbc.20 for ; Fri, 13 Dec 2013 14:26:27 -0800 (PST) X-Received: by 10.67.5.131 with SMTP id cm3mr6090696pad.92.1386973587534; Fri, 13 Dec 2013 14:26:27 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.26.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:26 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Laura Abbott , John Stultz Subject: [PATCH 014/115] gpu: ion: Loop on the handle count when destroying Date: Fri, 13 Dec 2013 14:23:48 -0800 Message-Id: <1386973529-4884-15-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Laura Abbott When destroying a handle, all kernel mappings to that handle should be destroyed. Other handles may still have references and valid mappings to the buffer underneath which should not be destroyed. Loop on the handle reference count, not the buffer reference count to get rid of all kernel mappings for the handle. Signed-off-by: Laura Abbott [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz --- drivers/staging/android/ion/ion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index ddfe49a..dc7174d 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -232,7 +232,7 @@ static void ion_handle_destroy(struct kref *kref) mutex_lock(&client->lock); mutex_lock(&buffer->lock); - while (buffer->kmap_cnt) + while (handle->kmap_cnt) ion_handle_kmap_put(handle); mutex_unlock(&buffer->lock);