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: 4384661 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 1B04CBEEAA for ; Thu, 19 Jun 2014 15:14:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57D9120384 for ; Thu, 19 Jun 2014 15:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3358202AE for ; Thu, 19 Jun 2014 15:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756991AbaFSPOt (ORCPT ); Thu, 19 Jun 2014 11:14:49 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:23908 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756959AbaFSPOs (ORCPT ); Thu, 19 Jun 2014 11:14:48 -0400 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 linux-samsung-soc@vger.kernel.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 Cc: linux-samsung-soc@vger.kernel.org, inki.dae@samsung.com, kgene.kim@samsung.com, joshi@samsung.com, r.sh.open@gmail.com, Rahul Sharma 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 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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;