From patchwork Tue Aug 27 13:30:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuomas Tynkkynen X-Patchwork-Id: 19547 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA5D7248E8 for ; Tue, 27 Aug 2013 13:35:34 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id c41sf5324004yho.2 for ; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=BFzTxDruXGMthQcKKugYfo5WENFP8GtHANsD5B4fC7E=; b=mOdIazSbBsikSD71pz+qeMo/11geUfBws/8xoGGCWMRO5VPYb/mqqsxB0xsaygNZgw 3lZvzIbg6rW0O8w/kwhisOVj4R/+oc2BDskZBv8tnOOMTuNBY6FaQDATjeD0WAJZWgHB BoMDxntpGQHxGPGb/Ig1jgO7Vhv3Ge0UWvSVr7SpB2RtQNJnOlZrWiHRwM2f6oLnMBrI L7l3NxiBwalzpFTJS+kL6I0CYgXICWVvYQ1V16mYSqvrGBhuRJ2m1cHy4NSTFfVvKZrs m/W2+Wi6dRFFItYW1psWDm+C7JRxYXXNbKBDY24VItbw4QNpcpN5JFTxG4ZQ+SFliMxV e6BQ== X-Received: by 10.236.153.39 with SMTP id e27mr7621340yhk.14.1377610534308; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.99.106 with SMTP id ep10ls2449930qeb.59.gmail; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) X-Received: by 10.220.164.70 with SMTP id d6mr10913516vcy.19.1377610534181; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id zt2si4890975vec.36.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Aug 2013 06:35:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id ha12so3156989vcb.9 for ; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) X-Gm-Message-State: ALoCoQmS3B8gvqLNnB2Sb5kEtkdHVimb8Rmaj9SfG0WtnsPF1NC+890xhKwKhYbA3fryoq5jUzw9 X-Received: by 10.52.165.45 with SMTP id yv13mr17196927vdb.1.1377610534025; Tue, 27 Aug 2013 06:35:34 -0700 (PDT) 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 u4csp294970vcz; Tue, 27 Aug 2013 06:35:33 -0700 (PDT) X-Received: by 10.14.178.66 with SMTP id e42mr3667170eem.67.1377610532937; Tue, 27 Aug 2013 06:35:32 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 7si13911709eeo.289.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Aug 2013 06:35:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1VEJPr-000711-Pv; Tue, 27 Aug 2013 13:34:39 +0000 Received: from hqemgate14.nvidia.com ([216.228.121.143]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1VEJLV-00070V-39 for linaro-mm-sig@lists.linaro.org; Tue, 27 Aug 2013 13:30:09 +0000 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 27 Aug 2013 06:30:27 -0700 Received: from hqemhub01.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Tue, 27 Aug 2013 06:30:47 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 27 Aug 2013 06:30:47 -0700 Received: from ttynkkynen-lnx.Nvidia.com (172.20.144.16) by hqemhub01.nvidia.com (172.20.150.30) with Microsoft SMTP Server (TLS) id 8.3.298.1; Tue, 27 Aug 2013 06:30:46 -0700 From: Tuomas Tynkkynen To: Date: Tue, 27 Aug 2013 16:30:38 +0300 Message-ID: <1377610238-2146-1-git-send-email-ttynkkynen@nvidia.com> X-Mailer: git-send-email 1.8.1.5 X-NVConfidentiality: public MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 27 Aug 2013 13:34:38 +0000 Cc: linaro-mm-sig@lists.linaro.org, Tuomas Tynkkynen , dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Subject: [Linaro-mm-sig] [PATCH] dma-buf: Check return value of anon_inode_getfile X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 anon_inode_getfile might fail, so check its return value. Signed-off-by: Tuomas Tynkkynen --- drivers/base/dma-buf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 1219ab7..2d5ac1a 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -133,7 +133,10 @@ struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, dmabuf->exp_name = exp_name; file = anon_inode_getfile("dmabuf", &dma_buf_fops, dmabuf, flags); - + if (IS_ERR(file)) { + kfree(dmabuf); + return ERR_CAST(file); + } dmabuf->file = file; mutex_init(&dmabuf->lock);