From patchwork Thu Jun 19 15:13:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4386691 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 387F4BF923 for ; Fri, 20 Jun 2014 01:36:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 590AB203B6 for ; Fri, 20 Jun 2014 01:36:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5D108203B5 for ; Fri, 20 Jun 2014 01:36:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E105A6E96C; Thu, 19 Jun 2014 18:36:32 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 951016E179 for ; Thu, 19 Jun 2014 08:14:48 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7F0000590MRX30@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 20 Jun 2014 00:14:46 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 26.E7.16580.66EF2A35; Fri, 20 Jun 2014 00:14:46 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-27-53a2fe669bda Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 30.F5.07139.66EF2A35; Fri, 20 Jun 2014 00:14:46 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7F006XA8ZV5M20@mmp2.samsung.com>; Fri, 20 Jun 2014 00:14:46 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [RFC] drm/exynos: abort commit when framebuffer is removed from plane Date: Thu, 19 Jun 2014 20:43:29 +0530 Message-id: <1403190809-8413-1-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsWyRsSkRjft36Jgg9anehZXvr5ns5h0fwKL xfddX9gtehdcZbOYcX4fk8XCF/EWUxYdZnVg99g56y67x/3u40wefVtWMXp83iQXwBLFZZOS mpNZllqkb5fAlXFy2R62gqmcFY+XazUwXmbvYuTkkBAwkVhwcD0rhC0mceHeerYuRi4OIYGl jBIz56+CK1pzZBpUYjqjxLpTt5ghnHYmidXt38Gq2AR0JWYffMYIYosIKEv8nbiKEaSIWWA5 o8TLzS1sIAlhAT+JvhO/WLoYOThYBFQlXt/UBAnzCrhLHOz9DhaWEFCQmDPJBqRVQuA3m8SV yadYQGpYBAQkvk0+BFUjK7HpADPEcZISB1fcYJnAKLiAkWEVo2hqQXJBcVJ6kalecWJucWle ul5yfu4mRmCgnv73bOIOxvsHrA8xJgONm8gsJZqcDwz0vJJ4Q2MzIwtTE1NjI3NLM9KElcR5 0x8lBQkJpCeWpGanphakFsUXleakFh9iZOLglGpgXJW//rdTR9OL62UvmW/4+M7K5eyUus13 rkq2SVhtY/TLG70nsyL9086Kmq3RFG5qL5xx+eva3S2ztha3V2w7ufn5G8famPwDv4p162e/ v8P7iMneZfbkaWpShf+rNng6/FSZ9WX73eOLxCND72S9E+Pd+ljZK6l8h+7OO4dUF7z/+XDG i3OJ+5VYijMSDbWYi4oTAcFjb/BqAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsVy+t9jQd20f4uCDdbPV7W48vU9m8Wk+xNY LL7v+sJu0bvgKpvFjPP7mCwWvoi3mLLoMKsDu8fOWXfZPe53H2fy6NuyitHj8ya5AJaoBkab jNTElNQihdS85PyUzLx0WyXv4HjneFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKALlBTKEnNK gUIBicXFSvp2mCaEhrjpWsA0Ruj6hgTB9RgZoIGENYwZJ5ftYSuYylnxeLlWA+Nl9i5GTg4J AROJNUemsUHYYhIX7q0Hsrk4hASmM0qsO3WLGcJpZ5JY3f4drINNQFdi9sFnjCC2iICyxN+J qxhBipgFljNKvNzcAjZKWMBPou/EL5YuRg4OFgFVidc3NUHCvALuEgd7v4OFJQQUJOZMspnA yL2AkWEVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRnAcPJPewbiqweIQowAHoxIP70rVRcFC rIllxZW5hxglOJiVRHh3fwUK8aYkVlalFuXHF5XmpBYfYkwG2j2RWUo0OR8Yo3kl8YbGJuam xqaWJhYmZpakCSuJ8x5stQ4UEkhPLEnNTk0tSC2C2cLEwSnVwGj5W4il+M3xh7//elct4LGr qXplop++6XepRBRrKuMb3WoZU1b9RcGbOLt3L3vLt/gYq5R1AluN5MZ36w9em/3m5BLhU0mP VrMa3tBctpyf69Hht4d3p2y0W39gsdNRgcjTBbPm5ZYkf+NgerDk+Pxp8x88/iUQer2T68oF ofsFIa+aelb9eBaqxFKckWioxVxUnAgAV8UygscCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 19 Jun 2014 18:36:31 -0700 Cc: kgene.kim@samsung.com, joshi@samsung.com, linux-samsung-soc@vger.kernel.org, Rahul Sharma X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 This situation arises when userspace remove the frambuffer object and call setmode ioctl. drm_mode_rmfb --> drm_plane_force_disable --> plane->crtc = NULL; and drm_mode_setcrtc --> exynos_plane_commit --> passes plane->crtc to exynos_drm_crtc_plane_commit which is NULL. This crashes the system. Signed-off-by: Rahul Sharma --- This works fine but I am not confident on the correctness of the solution. drivers/gpu/drm/exynos/exynos_drm_crtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 95c9435..da4efe4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -165,6 +165,12 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y, return -EPERM; } + /* when framebuffer is removed, commit should not proceed. */ + if(!plane->fb){ + DRM_ERROR("framebuffer has been removed from plane.\n"); + return -EFAULT; + } + crtc_w = crtc->primary->fb->width - x; crtc_h = crtc->primary->fb->height - y;