From patchwork Fri Jul 27 15:18:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10335 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8A12C23F61 for ; Fri, 27 Jul 2012 15:19:09 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 329D2A19166 for ; Fri, 27 Jul 2012 15:19:09 +0000 (UTC) Received: by yenq6 with SMTP id q6so3284412yen.11 for ; Fri, 27 Jul 2012 08:19:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:date:message-id:x-mailer:x-brightmail-tracker:x-tm-as-mml :cc:subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=My1wWomo1AuUnb04LzLogFjQEymoAwDaTzmqoZ+PvG4=; b=CBhEs/wcICM1bmsC2YlZYIp3vwa2WJoojgDLTelzmrYJKK2bX4jZCIp5KEOFNYDFZQ H0Wsb21aDmkPbHSA3pEMmisQmxqu1ESpEGbT8o1/axEeuB3G2tHdmsVb4nL5lpCK784C iPtNxLavCx6PNFLiQhiflNFvPVjjuww+0eJZ2qMSEqgFoznVBlHdemoeWECCExUCrXAo iyPDa7A90uA9OM1PSrfrp8Z6aJB77AGgMw+SJPCKBosr/hzW76sujzxw9ANp9KmtD/5j BjuE/2mcpFSqgg2h+KmB+uZs53rjezn/+4ljslT0y4eLoJkGnE1xzeYY/NEP/sRc3CVC tGxg== Received: by 10.50.242.73 with SMTP id wo9mr2378028igc.1.1343402348233; Fri, 27 Jul 2012 08:19:08 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.43.93.3 with SMTP id bs3csp37651icc; Fri, 27 Jul 2012 08:19:07 -0700 (PDT) Received: by 10.180.78.2 with SMTP id x2mr7057380wiw.10.1343402346386; Fri, 27 Jul 2012 08:19:06 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id k55si3061546wes.85.2012.07.27.08.19.05; Fri, 27 Jul 2012 08:19:06 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SumJi-0000fa-GE; Fri, 27 Jul 2012 15:19:02 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SumJg-0000fQ-Vf for linaro-mm-sig@lists.linaro.org; Fri, 27 Jul 2012 15:19:01 +0000 Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M7T0030WRULJB80@mailout4.samsung.com> for linaro-mm-sig@lists.linaro.org; Sat, 28 Jul 2012 00:18:57 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-39-5012b1602b0d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6A.34.19326.061B2105; Sat, 28 Jul 2012 00:18:56 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M7T00LEERV6SY90@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Sat, 28 Jul 2012 00:18:56 +0900 (KST) From: Marek Szyprowski To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org Date: Fri, 27 Jul 2012 17:18:34 +0200 Message-id: <1343402314-15678-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.10 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNJMWRmVeSWpSXmKPExsVy+t9jAd2EjUIBBt3fLS2+XHnI5MDocfvf Y+YAxigum5TUnMyy1CJ9uwSujJkrW9kK1rBV7Dm0hK2BcQFrFyMnh4SAicSXDWdYIGwxiQv3 1rN1MXJxCAksYpTYP+U2O4Szlkni0KwGJpAqNgFDia63XWwgtoiAh8STFeeYQYqYBRYzS7z7 sIyxi5GDQ1jAX+LIwzqQGhYBVYmbM3vBNvAC1S9/P5UZYpu8xNP7fWwTGLkXMDKsYhRNLUgu KE5KzzXUK07MLS7NS9dLzs/dxAj24jOpHYwrGywOMQpwMCrx8E7kFQoQYk0sK67MPcQowcGs JMKrvQooxJuSWFmVWpQfX1Sak1p8iFGag0VJnNfY+6u/kEB6YklqdmpqQWoRTJaJg1OqgTGj ZsuTKazOHx0tr07g/HU8rqfnvtmBKVU5arOFtTlUHtml8NSWs6656yyfXF9yjzXtr8i+p0fU JjmJmPfJzgm7u0u9XyD95fkFRT/3OCzIMZOIk8udd4SFo4LtY9mdhp/cm26dz49fLvVlaY7J ddaJr+/sYH4i8eDipn9e64LUGVUDZQJs7JVYijMSDbWYi4oTAarA0pLeAQAA X-TM-AS-MML: No Cc: Abhinav Kochhar , Russell King - ARM Linux , Arnd Bergmann , Kyungmin Park , Subash Patel Subject: [Linaro-mm-sig] [PATCH] ARM: DMA-mapping: fix error path for memory allocation failure X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkZbb5jqDQWVc8dy/Uy6G8E9O0vcbTuGgsSVPfgR2fC14n7jfoKHLvNOdFqPVOXGkDlPI8A This patch fixes incorrect check in error path. When the allocation of first page fails, the kernel ops appears due to accessing -1 element of the pages array. Reported-by: Sylwester Nawrocki Signed-off-by: Marek Szyprowski --- arch/arm/mm/dma-mapping.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 7a1d224..3096ed2 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -977,7 +977,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t return pages; error: - while (--i) + while (i--) if (pages[i]) __free_pages(pages[i], 0); if (array_size <= PAGE_SIZE)