Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3707665imu; Mon, 28 Jan 2019 09:22:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN6l92sw0C5QYnlZUfexynoy/o/LjPOw1+kP8scisS12emw94mGdlczVmUr5myTgK8UhUZS8 X-Received: by 2002:a63:b0a:: with SMTP id 10mr20661657pgl.423.1548696178288; Mon, 28 Jan 2019 09:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696178; cv=none; d=google.com; s=arc-20160816; b=0aK6Z+tkprj0wTzm3LPO/enM9dzf+TZUS1Q29jIF6GkcmgkUlgFXm83K/0XD+VWkx7 bfP2Ql9TPQYS/nKBNTykLjsSPCzPRqG2TH08N9RM4aaFAZ5QwxNnEqGqUca6CbsPqslx HxRde7Fn/2WbwuAkqv0D9LhzZTb0umDimfpLCHN/ZrToxavV7IGzdDfmqA17mEtkidQA 9qofzjBby2oSTqYeBrFZL06jkwzH0sFUPXDNjYVloRARoIZNw6RTgkquOL7kBJjzPEjy 89O+npmuccmZfCX625Pz+cw0zzR6CFbb+pi9RmBoQsXprhp277WjzngBx6Xl93Irovsq Y6Bw== 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=iA9dtqljeiB7TmtGMsxb08XaS4KWbMoDr0EwQ1ZPrpA=; b=tkIC9zOtLF++1ZWkRv7p+egflaAY+rdhps1tyiZKosI2XCkDXpzCU7K3//iJw+J5MR sHzDEgYaOkliY3pPY0C9FwxF9mycLlGfYa2SFqA5lR9WgjSWjuMV81IDUcIcl5JQbxFi ESZOmhvm0ZFx7L4zMU8olMKk3DPsuVRZVNNdI2tY1OuFFVJOCwiVgbVYNYDoE0revG3F E45TumUpvLwFnBgmtYgagoDkGkd8oQ2gvHEo9zPJAuOv0NPHENebEufQGfDrvekwW6Ph 7fvYvTHaDRmpwtHJVu8O8YgoCYBZUKlP8m5QMRmV6taHhrl+6hRgqB7fSN08fXaSsHoh GEOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BAs+PY4k; 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 d3si31812823pll.161.2019.01.28.09.22.42; Mon, 28 Jan 2019 09:22:58 -0800 (PST) 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=BAs+PY4k; 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 S1731772AbfA1RW1 (ORCPT + 99 others); Mon, 28 Jan 2019 12:22:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:48684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730145AbfA1QDW (ORCPT ); Mon, 28 Jan 2019 11:03:22 -0500 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 CB5072082E; Mon, 28 Jan 2019 16:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691402; bh=kWpK/HnV9JtBXaeQN26gB/YUUoXK8zH4so1rYdjcUzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BAs+PY4kM5joeBfhV/axAibLYvK/IbWxQq4bVkBsNmzuqoSDh2QAYpiHhJCDeiDoP WylogY45p7st6Y7ysucItWfxOPEdFMZ44OZa6RFknCC1Fe1meHgAoUEvDouh/fwZ0A jj7JqlcBPvRbdYa1TDXUEyUJ6HlwMWy2KbmszV9o= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sean Paul , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 082/258] drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state() Date: Mon, 28 Jan 2019 10:56:28 -0500 Message-Id: <20190128155924.51521-82-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-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: Sean Paul [ Upstream commit aa394b0dd68cb00c483e151dcd84713d4d517ed1 ] drm_atomic_helper_commit_duplicated_state() sets state->acquire_ctx to the context given in the argument and leaves it in state after it quits. The lifetime of state and context are not guaranteed to be the same, so we shouldn't leave that pointer hanging around. This patch resets the context to NULL to avoid any oopses. Changes in v2: - Added to the set Suggested-by: Daniel Vetter Reviewed-by: Daniel Vetter Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-1-sean@poorly.run Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_atomic_helper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index f77bff5aa307..23397c08be11 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3192,7 +3192,7 @@ EXPORT_SYMBOL(drm_atomic_helper_suspend); int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, struct drm_modeset_acquire_ctx *ctx) { - int i; + int i, ret; struct drm_plane *plane; struct drm_plane_state *new_plane_state; struct drm_connector *connector; @@ -3211,7 +3211,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, for_each_new_connector_in_state(state, connector, new_conn_state, i) state->connectors[i].old_state = connector->state; - return drm_atomic_commit(state); + ret = drm_atomic_commit(state); + + state->acquire_ctx = NULL; + + return ret; } EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state); -- 2.19.1