From patchwork Sat Dec 14 03:26:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22467 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 22ECB23908 for ; Sat, 14 Dec 2013 03:26:52 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq1sf192539igb.1 for ; Fri, 13 Dec 2013 19:26:51 -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=JeLL729ZZISjGJ3Bh8HLaxGzu6fRcORgfl5qaJPpsjA=; b=NV5z/ZjDKIBTA/N+gizRvc5uE+ekyfT0xAvv2bgHvXVEf1jLzeZ0QIH5RDgwq9cp0G DSSCB6NGTcwN+24L3ddHPz+J/pyUT7ao+oYO9fKWhhbMzMOuhNGmnFICcn2x8rIrL6P1 5b1dhTu1LxiGnK5wOxcSAEpCyT1SsPV+3WKodWFumVOyOZnd+oePuKP0bufRPVz4On52 MzKHGFFSlNciyn0lKroQuFAk4PzfawndR2SHUN7MiyqzvQHpocmvyBxxFrMUNR/fQtlg iyEHb9bUhXe+YUxzr/8dJta2YmLNe7jGtQEiD3ZGu32vzn+uqFHBYk0Rpo6yYGEOrZnk tY1w== X-Gm-Message-State: ALoCoQle416fPhqj732vYr06VN6COvEf4XAWeL5Bwq50EYevo0a4ZvlfXU6LYkU0YZ9EVcm6zRPs X-Received: by 10.182.146.44 with SMTP id sz12mr2085404obb.17.1386991611802; Fri, 13 Dec 2013 19:26:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.193 with SMTP id go1ls1292239qeb.97.gmail; Fri, 13 Dec 2013 19:26:51 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr2627739vcx.1.1386991611634; Fri, 13 Dec 2013 19:26:51 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id pu5si1427752veb.59.2013.12.13.19.26.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:26:51 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id i12so1867677vbh.32 for ; Fri, 13 Dec 2013 19:26:51 -0800 (PST) X-Received: by 10.220.189.2 with SMTP id dc2mr5151vcb.60.1386991611532; Fri, 13 Dec 2013 19:26:51 -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 u4csp86931vcz; Fri, 13 Dec 2013 19:26:51 -0800 (PST) X-Received: by 10.66.161.38 with SMTP id xp6mr7014275pab.145.1386991610690; Fri, 13 Dec 2013 19:26:50 -0800 (PST) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by mx.google.com with ESMTPS id q8si2974407pav.144.2013.12.13.19.26.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:26:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.49 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.49; Received: by mail-pb0-f49.google.com with SMTP id jt11so3307428pbb.8 for ; Fri, 13 Dec 2013 19:26:50 -0800 (PST) X-Received: by 10.68.130.39 with SMTP id ob7mr7170760pbb.63.1386991610323; Fri, 13 Dec 2013 19:26:50 -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 nw11sm11680086pab.13.2013.12.13.19.26.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:26:49 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Mitchel Humpherys , John Stultz Subject: [PATCH 097/115] gpu: ion: fix use-after-free in ion_heap_freelist_drain Date: Fri, 13 Dec 2013 19:26:17 -0800 Message-Id: <1386991595-6251-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386991595-6251-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> <1386991595-6251-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.212.45 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: Mitchel Humpherys The `buffer' variable is being used after being freed. Fix this. Signed-off-by: Mitchel Humpherys Signed-off-by: John Stultz --- drivers/staging/android/ion/ion_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index deaab7c..0a5cea0 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -200,9 +200,9 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size) if (total_drained >= size) break; list_del(&buffer->list); - ion_buffer_destroy(buffer); heap->free_list_size -= buffer->size; total_drained += buffer->size; + ion_buffer_destroy(buffer); } rt_mutex_unlock(&heap->lock);