From patchwork Fri Jul 5 06:32:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonyoung Shim X-Patchwork-Id: 2823991 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9A8739F3EB for ; Fri, 5 Jul 2013 06:44:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDF112015D for ; Fri, 5 Jul 2013 06:44:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BCCCC2015B for ; Fri, 5 Jul 2013 06:44:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A34BAE6000 for ; Thu, 4 Jul 2013 23:44:55 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 10236E66BC for ; Thu, 4 Jul 2013 23:32:31 -0700 (PDT) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MPG007AFA5BSML0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 05 Jul 2013 15:32:29 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.113]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 4D.F8.29708.C7866D15; Fri, 05 Jul 2013 15:32:29 +0900 (KST) X-AuditID: cbfee690-b7f6f6d00000740c-d4-51d6687cc40c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 04.B5.28381.C7866D15; Fri, 05 Jul 2013 15:32:28 +0900 (KST) Received: from localhost.localdomain ([10.89.53.198]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MPG003G7A63TX10@mmp1.samsung.com>; Fri, 05 Jul 2013 15:32:28 +0900 (KST) From: Joonyoung Shim To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: cma: fix refcounting on the dmabuf import error path Date: Fri, 05 Jul 2013 15:32:35 +0900 Message-id: <1373005955-29835-1-git-send-email-jy0922.shim@samsung.com> X-Mailer: git-send-email 1.8.1.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsWyRsSkULc241qgQb+xxYnri5gsrnx9z2bR OXEJu8WCjY8YHVg8ds66y+4xu2Mmq8f97uNMHp83yQWwRHHZpKTmZJalFunbJXBl7Ny7j71g LlfFixl1DYxHOboYOTkkBEwkpkxezQJhi0lcuLeeDcQWEljKKNF9RBympqX/HmsXIxdQfBGj xNvlM1kgilqZJPa8EQax2QT0JO5sO84EYosIKEv8nbiKEcRmFgiQWD1vFli9sICXxMG2fmYQ m0VAVaLt+2SgGg4OXgF3icULqiF2KUj8vHyCDWSXhMBzNokPtzeyQtQLSHybfIgFpF5CQFZi 0wFmiHpJiYMrbrBMYBRcwMiwilE0tSC5oDgpvchErzgxt7g0L10vOT93EyMwDE//ezZhB+O9 A9aHGJOBxk1klhJNzgeGcV5JvKGxmZGFqYmpsZG5pRlpwkrivOot1oFCAumJJanZqakFqUXx RaU5qcWHGJk4OKUaGAOVXpkZlLzW3/qXf/+HA7UtT5+kvvcS3HVH5F9a1tYoW4Pjcg4avTe1 WR6sPTi5/6nHMUkR99knTDpX5n/i1mhtlu+S73ktY2keNGn1Adfm7OVJFm1p6aVb19ftXKMQ tfXv/8p9kUe+9/a7tTdpbTS0UhAvytkXFPn3no7epXOnH+6SusA6UYmlOCPRUIu5qDgRAGP9 anxZAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsVy+t9jAd2ajGuBBhO6zCxOXF/EZHHl63s2 i86JS9gtFmx8xOjA4rFz1l12j9kdM1k97ncfZ/L4vEkugCWqgdEmIzUxJbVIITUvOT8lMy/d Vsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB2inkkJZYk4pUCggsbhYSd8O04TQEDdd C5jGCF3fkCC4HiMDNJCwhjFj59597AVzuSpezKhrYDzK0cXIySEhYCLR0n+PFcIWk7hwbz1b FyMXh5DAIkaJt8tnsoAkhARamST2vBEGsdkE9CTubDvOBGKLCChL/J24ihHEZhYIkFg9bxZY vbCAl8TBtn5mEJtFQFWi7ftkoBoODl4Bd4nFC6ohdilI/Lx8gm0CI/cCRoZVjKKpBckFxUnp uYZ6xYm5xaV56XrJ+bmbGMGB/kxqB+PKBotDjAIcjEo8vBZNVwOFWBPLiitzDzFKcDArifDa J1wLFOJNSaysSi3Kjy8qzUktPsSYDLR8IrOUaHI+MArzSuINjU3MjCyNzA0tjIzNSRNWEuc9 0GodKCSQnliSmp2aWpBaBLOFiYNTqoGxXqbCc8nrRT+/HS0tyXW0PVbmk/vobN/dgrYMq1ib 54Vd2RdWxdrc2WQ/tWHDd/t5nRpubRd7Gbrkd/ypS/jlMLEuyW++dF/GVLZpEhpRnZq6ka8u PPhceVquxfT0tC8FXE3vCqItzK78k3z0dMPClvhjR70DnM/fufr+a8gJkTOiPKEzow2VWIoz Eg21mIuKEwHKp8WfuAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: laurent.pinchart@ideasonboard.com, stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From drm gem CMA helper, it wasn't fixed dma_buf refcount problem fixed by commit 011c228. This patch solves it. Signed-off-by: Joonyoung Shim Acked-by: Laurent Pinchart --- drivers/gpu/drm/drm_gem_cma_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index ce06397..3f3a12b 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -554,7 +554,6 @@ struct drm_gem_object *drm_gem_cma_dmabuf_import(struct drm_device *drm, * refcount on gem itself instead of f_count of dmabuf. */ drm_gem_object_reference(obj); - dma_buf_put(dma_buf); return obj; } } @@ -573,6 +572,8 @@ struct drm_gem_object *drm_gem_cma_dmabuf_import(struct drm_device *drm, goto error_gem_free; } + get_dma_buf(dma_buf); + sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); if (IS_ERR_OR_NULL(sgt)) { ret = sgt ? PTR_ERR(sgt) : -ENOMEM; @@ -597,6 +598,7 @@ error_buf_unmap: dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); error_buf_detach: dma_buf_detach(dma_buf, attach); + dma_buf_put(dma_buf); error_gem_free: drm_gem_cma_free_object(&cma_obj->base); return ERR_PTR(ret);