From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 358C4C10F05 for ; Tue, 26 Mar 2019 06:45:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 099AE2070B for ; Tue, 26 Mar 2019 06:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553582714; bh=/JV6CD7RQjbENMENs3f3NH0IoYpEUhjncpsBLd+zAZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pqJGiWSN4Sx8SEP4yvNuzcVOFa3tZtGoSQ6nO4AUCn3EJrXWQq3IgHlwAFgBF0Srl OHw9mksLEdt3vrnG5t4qFY9K5Q9/tPWTZ8Kczgoqlvq5x9ArCO5HSKnXsFduYj4Yac i9yLoKsxtF5fZA80GvtH1V2Pifvw/8qU8iKcElts= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731497AbfCZGes (ORCPT ); Tue, 26 Mar 2019 02:34:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:45678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731527AbfCZGer (ORCPT ); Tue, 26 Mar 2019 02:34:47 -0400 Received: from localhost (unknown [104.132.152.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89FBF2070B; Tue, 26 Mar 2019 06:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553582087; bh=/JV6CD7RQjbENMENs3f3NH0IoYpEUhjncpsBLd+zAZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1wYjre+6oM4xSvug/CHQQ5miAA0jODEdhQ1IfO2rtP1SK0eP3L0SkriFERkCe1LAv AcG8XNqm0giQQk/2Sdw4F8+8VIbkgWvKxAG+AfBNuqu9WSY1A2aDBW1/J1/TkWW1wN 5r/syCufu5KlDkymqF+QDiJrvUQWo/3EdEq3CpH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com, Chris Wilson , Daniel Vetter , Maarten Lankhorst , Sean Paul , David Airlie Subject: [PATCH 4.14 23/41] drm: Reorder set_property_atomic to avoid returning with an active ww_ctx Date: Tue, 26 Mar 2019 15:30:00 +0900 Message-Id: <20190326042651.169017976@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326042649.889479098@linuxfoundation.org> References: <20190326042649.889479098@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Wilson commit 227ad6d957898a88b1746e30234ece64d305f066 upstream. Delay the drm_modeset_acquire_init() until after we check for an allocation failure so that we can return immediately upon error without having to unwind. WARNING: lock held when returning to user space! 4.20.0+ #174 Not tainted ------------------------------------------------ syz-executor556/8153 is leaving the kernel with locks still held! 1 lock held by syz-executor556/8153: #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at: set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462 Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com Fixes: 144a7999d633 ("drm: Handle properties in the core for atomic drivers") Signed-off-by: Chris Wilson Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Sean Paul Cc: David Airlie Cc: # v4.14+ Reviewed-by: Maarten Lankhorst Link: https://patchwork.freedesktop.org/patch/msgid/20181230122842.21917-1-chris@chris-wilson.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_mode_object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -432,12 +432,13 @@ static int set_property_atomic(struct dr struct drm_modeset_acquire_ctx ctx; int ret; - drm_modeset_acquire_init(&ctx, 0); - state = drm_atomic_state_alloc(dev); if (!state) return -ENOMEM; + + drm_modeset_acquire_init(&ctx, 0); state->acquire_ctx = &ctx; + retry: if (prop == state->dev->mode_config.dpms_property) { if (obj->type != DRM_MODE_OBJECT_CONNECTOR) {