Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5640801img; Wed, 27 Mar 2019 12:15:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiflfzbqXaIvrTdRJXY3hveQpO+CQPgCijFIMet//2VlKoN6GA4qzOkKfavkJi5nlEG4Vb X-Received: by 2002:a65:6108:: with SMTP id z8mr22053877pgu.106.1553714119925; Wed, 27 Mar 2019 12:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714119; cv=none; d=google.com; s=arc-20160816; b=t3XuvtJ/JlQnzbRcdLg3wT0GDxsLf1zlLqLiPOsaC1rVqDwbUa1ol7gjyTN4Q8WQne K51YJLlfG0ZV+NABecfNPqiq6TNkNleXT2FMfjoD28ieV7KBT1VwQpmF8PCGWSs52Llz +NZL64G+ae/77p5L+r9g93O0YBGoeSPKlREUqdscjuJiG2Xj3afO7/cco3qTm1aDGGcN tjhA4u3wCQ698jkg/zv+vM6vWEXfpEcWp1EXaBLI7Ifepb1rBPIkBaB5PTqSSSFftKnG psnt4JIgDgqXYx9ggxdCvdCvDorioLFT6QkH70dDuIQYUVNHAPaaOqxvVGcoYv0AuPj4 B7yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fi6oVMBhpRws4GvHOpp9YSB5PMMJtveGw6mNW50hfMU=; b=obwe3BDkK309bk15xL+7gjk9cynMLYJ98sePelFU2uan5EAD4DsZows5Fg+TRz6V+5 5JgFcr9rgrEFDWqhqd9undWXhfViTpw+NV588O8Nc5KP2cJkAMFtkAuouWs2XfemlIEx DC+1S+sixlipvwxtQVkbkB0s3zG5VsF/7qJZ/bG/3fJJ2onWPjV50o0Lie40gf2DARek uC4H3gHbJfKUGloKMGYcBK/dV1Wr+rKMIvy9Lhaw7/LvBSrYHa6x3Axpyof/yUjPNZ99 gMhGkW+BBlC0+lEHUVXvPkLMZMbFlFtiVRT+xQ6uFCjt9i9xV1CgGuN6P9BijHuY+7CF UX/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/t8dPdo"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i196si18100656pgd.113.2019.03.27.12.15.04; Wed, 27 Mar 2019 12:15:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/t8dPdo"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388861AbfC0TNR (ORCPT + 99 others); Wed, 27 Mar 2019 15:13:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:52222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388761AbfC0SKP (ORCPT ); Wed, 27 Mar 2019 14:10:15 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 05DA72186A; Wed, 27 Mar 2019 18:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710215; bh=AwNqZ837H+sTkz985OPXvZ7d55Tmz88sdkP+w0FuKeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/t8dPdoNFqGrbnp8lUF7XrbF62bJvdqqTw4yZi2NYWChyVv5CmaSmXf+JzLRKoC/ 2HMyGwziHtlfXwF0Ldf1zSh11rwaU/Ke6EAAeTyQidMqQnOSsBInMr6eSHJwsYxegi NEZu/PvuTj92m3Dh3CBjWJQwJ7CZCc8tLFscRzaQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chris Wilson , Daniel Vetter , Maarten Lankhorst , Sean Paul , David Airlie , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.0 256/262] drm: Reorder set_property_atomic to avoid returning with an active ww_ctx Date: Wed, 27 Mar 2019 14:01:51 -0400 Message-Id: <20190327180158.10245-256-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson [ Upstream commit 227ad6d957898a88b1746e30234ece64d305f066 ] 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: Sasha Levin --- drivers/gpu/drm/drm_mode_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 004191d01772..15b919f90c5a 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -465,6 +465,7 @@ static int set_property_atomic(struct drm_mode_object *obj, 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) { -- 2.19.1