From patchwork Tue Apr 5 08:50:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 8748831 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0ACAEC0553 for ; Tue, 5 Apr 2016 08:44:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10F4020320 for ; Tue, 5 Apr 2016 08:44:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2806820145 for ; Tue, 5 Apr 2016 08:44:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98DF46E70B; Tue, 5 Apr 2016 08:44:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0087.outbound.protection.outlook.com [207.46.100.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB1FA6E70B for ; Tue, 5 Apr 2016 08:44:10 +0000 (UTC) Received: from BN3PR0301CA0077.namprd03.prod.outlook.com (10.160.152.173) by CY1PR0301MB0716.namprd03.prod.outlook.com (10.160.159.146) with Microsoft SMTP Server (TLS) id 15.1.443.12; Tue, 5 Apr 2016 08:44:09 +0000 Received: from BN1AFFO11OLC004.protection.gbl (2a01:111:f400:7c10::120) by BN3PR0301CA0077.outlook.office365.com (2a01:111:e400:401e::45) with Microsoft SMTP Server (TLS) id 15.1.447.15 via Frontend Transport; Tue, 5 Apr 2016 08:44:09 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.158.2) smtp.mailfrom=gmail.com; linux.ie; dkim=none (message not signed) header.d=none; linux.ie; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.158.2 as permitted sender) Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11OLC004.mail.protection.outlook.com (10.58.53.75) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Tue, 5 Apr 2016 08:44:08 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u358i5DD007399; Tue, 5 Apr 2016 01:44:06 -0700 From: Liu Ying To: Subject: [PATCH] drm/crtc_helper: Reset empty plane state in drm_helper_crtc_mode_set_base() Date: Tue, 5 Apr 2016 16:50:39 +0800 Message-ID: <1459846239-8946-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.5.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131043194493026557; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(199003)(189002)(1096002)(1220700001)(33646002)(19580405001)(50466002)(19580395003)(81166005)(76482005)(36756003)(86362001)(77096005)(55446002)(106466001)(83322999)(92566002)(6260500002)(110136002)(82202001)(189998001)(11100500001)(4326007)(81442002)(47776003)(105596002)(104016004)(6806005)(2906002)(87572001)(50226001)(50986999)(48376002)(586003)(5003940100001)(61266001)(2351001)(229853001)(73972006)(5008740100001)(73392002)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0716; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC004; 1:a1dHiCdsKKRg5rywO5ndRfaPYz9o49ydtG7fG81HjW1NS3YpBCXfEpA7SO89I7f63Cdf3LMNS1UrZHYH3tkVujCcdb8zE/rL728b2u1INAsp+PzDxU/H/fxNymElYrNdBbZ1uWEUd/YdPfUML8q0hLeJ/qL/ixrn7j9BBeoFCInzP3U+/8+eKyOXlvc4ltEl+W3MvcqJSAqVFYV/YUpX0Ag0HQYztzZWSshQFvuVoLp4VSGhrDZH/2sscfuJKOAqCpEbMBlCBMb2P9NWJ5BURXE1QYFArxIFcB0mrtClblSKonNRoGNRqiOeqjR9Fy0hOkO3iY75D8jZDmrgy/hcbPP/mYd4YDKzI7v2IeLqxoToSX0Ahv/QyR32huoOBLZI0dkvaptLkDYyookkb3fmbvR+pvA/QDhUeEy6i2ysW0xPY9OWgr+jeDHbZlwVs3cB7IZA+bUl2d7lErzGh4ni5nY30IcE9qvS+syyP/gef+mTSzgyEjdRoE36QH5NAZuPDTIcWNkr1YTJO+r0K6isiDZa3F9NBd+dIiXfP238NQolDLxDxkibXD+XItSRnYBtJFZ6BXT6bCmO+bh4O+aC7w== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c4f67485-3536-4c9d-361d-08d35d2e7461 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0716; 2:a4TB7r7fQFsolOl19luNzlmNq1ozwbB7J1Rrkm0oL+KPsJh0v/7nOvHBC6VruHHJsGDvuEX6vGP23LM7JmqFb+zdz4IHL0Gh8Pvvlw8hDsDqGAZbZ0Zlz354c0WHgkKNhGwAtbDtgGXlgPPrqRF/k4qJ4P+t59AC5pJipRCqVdCEmr+npnHeCZZH1cheFY9U; 3:yID8pDJlqHBDJBqza4LJQmwgP0KEfYeQMjrGcxwdgCVSN1V+l/371WFzofqqJ9EqVKBaykIyTGSX9/QtqurZ5FE8IQHj5jvqC0PnIARFt3KTsbHKfIrMc6akbFo8GxmkGHnbc0+FsKtGjsI2qgKNcFiq4FtY3W3HHYocZFqMETPzlGcWHlV6373XS36ubkfuOfCjYINh3BGP42rMbmE7GAFsLoMWZert/qMug7hPI24=; 25:oKFJwE+UDNgskKll18pKKFkOrSrK164aNtR/LqcyS8qts6Wronp7dU+mPOTAo05e7Yx2sJ3/DvwVlVfXQG9pkseji6pR991zaCAkr0rEwLeFkyKQr5/W96PeMYk4gmzPg+wiWDpDhHQ4OHa6xD0fmzBNdq3G2fLPZMQ/hH0KZEJMZ1KH58v/PDGRKKLFxHH79uDEdotUgdnBLonkvhzhSTShUrjBtHk63d/K9YxrWgU3N2qivEz4nP4DQiiTlvUPsB+PTzGiSOm4v8oNxIT7McTI8LBJMSPj/lLKWyFK8P6bPW7wUgRRA4sSn8WxdiO8IUXaPG4RmpCBK2sHjW5CRaWN8Mqfpnmij6JVd/zrBdE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0716; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13024025)(13017025)(8121501046)(13018025)(13015025)(5005006)(3002001)(10201501046); SRVR:CY1PR0301MB0716; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0716; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0716; 4:nx9RVPNOgwVR1JlmU+KN6j1I1Tzby+BY0RfPPNt7WmjqRDVL6NRQ3HEmgZJf+uexa6dwxaPvx+7Jir6ydCxPodJODQFRs+xX54kytbCYzAkYzuZBHx1RNOdldURpadiUOUw+YaKtZQVK457PegIi70gFnkbdSPq/hBMWbqZldAD67Xdl91KMREwoP5FY9fvwehrZrhUw4NL+YYR5G+SUuRKAIDMLyhn16m5BSOfwKA/2V4C7Epb2eSRfw1h3xTlXhPXwrAC/Oa50Yc0PIpXXD/AbuRnKOeZpEWtlEgqf5FZONFdVfUeK8a2sumgWMs1lIz0OZxCoD6qkpsQlTC4AI/YPVEd4gFqbTtec9hbqjvkzV6AfRYTSPswMgg9BzRGMBUpiqiP+W7dI/UscJL+A/gzOPAEIv5ldWh06FUGGIjsYhNkArOvRDx0s/oNsfVKdsIoh9Wnp5VvevemH5g/DLg== X-Forefront-PRVS: 0903DD1D85 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0716; 23:LL+IC0zigNIIniN6MJDvYcG4u+97zhyi1zvtu8g?= =?us-ascii?Q?K1HSMtiUC221LjyUT4A2uD5uWPRDBv878xxGB4xx7XvLrhRZuflzyaqQnIZ/?= =?us-ascii?Q?wNUba/0U0AKHwvPVgEprRN1tv5NGPo0Hgjwv0mwb/kEcI/EaP34EDg3BPp0q?= =?us-ascii?Q?D1Qqc4brzkCXGTl7djszU3DZgHcD2X+laruVCTANMUwYExcR275n41UwZ8W0?= =?us-ascii?Q?WD6+yp63JyAqCKU/ywt2M5Ej4PHY/Mvp7f5sieAt/17WdQ3XNXN+6UfgfW2u?= =?us-ascii?Q?LLHtYzZ590fycs55MjZRVpz0EQsoMFocCoMbkL9lBLFOT3iAxNu2J3S7iga1?= =?us-ascii?Q?mpLBmPv5+mtq4blC+jSbHC4ttYsQVhTk7uTc7gVQS/ZOgn2Gm9HHukNidW6J?= =?us-ascii?Q?0JTC1UFXu0QNh0d1sxMOHRqjLWUJjFmY0FWwUAtukg5bC0TjhrDPiazwa6C0?= =?us-ascii?Q?AasNIfZ5lIYO58ho7wEFI5L/GLuR3ssmHiEAi5bRrg4P+SvSt9tvn1s13HCn?= =?us-ascii?Q?Be5/l8mDkI/vxpyrjGVc3OuhjsovfvueP9KYDwjy6RVeqVG0suqJj3hd+G30?= =?us-ascii?Q?Fq3WePgFdyeKKL04x1ynkW/w6YwvYQvqu7NZERg88hci4Yuo6jTJBxVXUp2v?= =?us-ascii?Q?6+VUiutRhzMMjepAtH7s/lH1HiagmYqWXPPjlObcrHUmrJfuVQhPejEV8pcy?= =?us-ascii?Q?Wi0WrshmM0cetS3IcfYoNaGvCDegUHcfolrF66q/StKQgnq+PpBzVvTO7hu2?= =?us-ascii?Q?s+1TaK/8uLQ7jn8V8xMvjbG33QTdfA6DLxL4x9ECpPIHXhD9I7qaALZxHu1H?= =?us-ascii?Q?rl+XdosZX3UAgRK11SGog6H+ACRUgkXiUoNWTZAPV3vkpNfb1kX1QFAKtL0Q?= =?us-ascii?Q?eZ0X/AaLHPxa1PqKsp/lQre3s6PfYaaMnXzEMGEOwByZbxPIwxDF8hQN0/zn?= =?us-ascii?Q?NtzT084GxXgiiKLUKes6LZKFil8OZx6k2gyWVGebwN1QIeddoGeniZjCEVlu?= =?us-ascii?Q?+zLtXbWSZJyOgxMzr5qvHVO6vjABafPa1Q+OjxkCE0h+R/fU/OJqHSwRBHQh?= =?us-ascii?Q?6tKR5/o7FXhB3fXg6ZNyz2ZTK+ii/LGRxZ6cI0BoxDHxKMpXrjYQjGqR/WY/?= =?us-ascii?Q?EY4cdfpD7JElYySJb9HdfM6hLi6mquVEe?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0716; 5:nunIK5Y5YX3k0Zqtggy8NCgCb5LXSJMDb1QUU1d8yvuh6eLFOsTbHUwW7HeZVFtz2/BOeoiJzH7GH7P1lNnKFn3XSJU3BKsSd0EY/dCaTaEZ7m52d/hnx2HgDUkipWskdr2/Mp6jMHbvIhXnUUHmxOMB6xTPiJhvKdD+lQmMgXg=; 24:TKnvb1hH9lt8suE2/K6pFV2YbFAdQ8auEqed3sxGryV8vH781SuXqNWf0d4k0cLnZD5zL9p0p26cp8sEkoIopc2L9YIcCwaSn35rs2fJJC4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 08:44:08.9438 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0716 Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, 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 Transitional drivers might access the NULL pointer plane->state in drm_helper_crtc_mode_set_base(), which causes NULL pointer dereference. So, let's reset it before handing it over to those drivers. commit e4f31ad2b713 ("drm: reset empty state in transitional helpers") did the same thing for other transitional helpers, but it seems this one was missed. Signed-off-by: Liu Ying --- drivers/gpu/drm/drm_crtc_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 79555d2..66ca313 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -1053,10 +1053,12 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, if (plane->funcs->atomic_duplicate_state) plane_state = plane->funcs->atomic_duplicate_state(plane); - else if (plane->state) + else { + if (!plane->state) + drm_atomic_helper_plane_reset(plane); + plane_state = drm_atomic_helper_plane_duplicate_state(plane); - else - plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL); + } if (!plane_state) return -ENOMEM; plane_state->plane = plane;