Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2768814imj; Mon, 11 Feb 2019 08:11:22 -0800 (PST) X-Google-Smtp-Source: AHgI3IYklCXEOmYnXZektuvNJtXw+kV6+U8YKMesv1H5udAGfm9JnJE1SEXZdOwSarJ3x3Uwrqkm X-Received: by 2002:a62:41cc:: with SMTP id g73mr12546956pfd.145.1549901482476; Mon, 11 Feb 2019 08:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901482; cv=none; d=google.com; s=arc-20160816; b=RMvDixFv5D/FisutWCiyMv5q3KRvddeZRAdyjIjG0VGwRFw5LuzE+IUnpux8gTKH2W 3QhAXshKAHyVeqEpNLP4gjw/Zps6T4RYJuU2lAD+XXGWl8QYGpsqiBZtqDQcfBs6mPly TSnA1z/b4uBGSL5BenYNyte781gw4wYTrUQOqf2gQ4CXPD0fXNUkuk0K7gmDhyN930jA 89MrcSpnTG58SONrsYcc/6PbeY287+6W+dM9v+utxdDz0qNuvoqv5X23lBhqr1RQaeYs RncVTltZU9k52OBitW5ENSIi5Fn5fW/t0vq9beddFp11HSwVQOOpDkbAJkHbnegZeZ14 bPLQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zbKiohDm8OI9+UkuiZ0zoXocE8F/NGBaOdahdWeYzho=; b=g+cTeXK0taCrE619HzOV2e1jEo8pUgNRpYRoSq/gTsvFVV785HdweGuY/xFk/73+wl pYlReA2n3DizSuyOdjZKPAW6Vg7MzOOtj5OiQABw4t6HLLsNz90F+HFN3L27RV5+Cr05 bpfoa5RJQlhzH6tzfWK854JEMYEfj695alRY/Hixh1YMneYFNNnO/wqUx+O0AioefIkN HfSlpfvjdfC2zvFRc8Fen1jFPZX2BNOthEtruSpmXegCq8L4D/hYupJWsG80+9/eQqQq XLI/pui6CkN6a4HopJk0nCFrKuFaxmBtDQfL8M2zVKvWTpoQM0or0QaEPa5JaxAn/grv NqSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WDUsbsVU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si9746698pgc.354.2019.02.11.08.11.05; Mon, 11 Feb 2019 08:11:22 -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=WDUsbsVU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729294AbfBKOY4 (ORCPT + 99 others); Mon, 11 Feb 2019 09:24:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:58192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbfBKOYx (ORCPT ); Mon, 11 Feb 2019 09:24:53 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 A7C5420821; Mon, 11 Feb 2019 14:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895093; bh=BKIQx9j4r4Qtd/A4GJUdte7mgsCXf4uoM2fMQJAPHqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDUsbsVUjgJ0SDRLViMdAjS6ppmUZy2kxa0prGm7BPsYzM1HRyEMKBg/rPgDbIvX7 XWF0G7zAa2pZSInEf/0kN2lFh0C9LGgOvqJeZczZJ/3OUGhKyv/onrPZ9peUPgxEQQ LOkKjpnbvRoVmPYV/370DdNJscUluFxBV34FXlVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Daniel Vetter , Sean Paul , Sasha Levin Subject: [PATCH 4.20 090/352] drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state() Date: Mon, 11 Feb 2019 15:15:17 +0100 Message-Id: <20190211141851.641640251@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 b4e292a56046..df86c2ebfc12 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3212,7 +3212,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; @@ -3231,7 +3231,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