From patchwork Thu Nov 29 15:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10704743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C376C13A4 for ; Thu, 29 Nov 2018 15:04:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5E172F4B0 for ; Thu, 29 Nov 2018 15:04:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEF002F4CB; Thu, 29 Nov 2018 15:04:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E98A2F4B6 for ; Thu, 29 Nov 2018 15:04:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7498188A23; Thu, 29 Nov 2018 15:04:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69E7088A23 for ; Thu, 29 Nov 2018 15:04:25 +0000 (UTC) Received: by mail-yb1-xb43.google.com with SMTP id p144-v6so843353yba.11 for ; Thu, 29 Nov 2018 07:04:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4fcwv6JqoJ5st0IYXWUDGjxmpHqF2ZTAq2o5EGZmAm8=; b=BwUZH9OzY9KxO2amUrRDpMxd2TQFjOV5/JDzGb74Z+pNjFpHIsWmFgZmG0RWPkNAyv OZxLSBkMerJwxdxFsibKzdvGS6Ya9DQOUIUSzdMJAboLvttrnlo1aOfuBBTtSY8CJl5/ IJF5NdQdK7o4ErMg5vCvhIH3QJ6afNIx8lsCf9KYKT27eszgtvA/zUsNlQo45zwu3OuY fOyQZT/kuJvO3EFI3EskN0fNRV9p29CP3Y0t+asNQqg1D9jUCFE0aSYk5lmFUWqRLMNh RHEvwxkFtF6ci5KA+SJiLGzC40PE5EMfIjhV1upsFO3M6fCHEjFk66F3W5mCwAwqp0Cd aSYw== X-Gm-Message-State: AA+aEWYJNIBp5QKd80ODyxye+OX6RU25INnlk4TI9fv4ii4TshUtEJoS CJofhOt/YNXD9Dghmj2AQTiB1H38e62eRg== X-Google-Smtp-Source: AFSGD/W+14zw4bApTCLjIIKyDbg68uxy2PCxIR4PRPo4RR56rPH1jAHERhVcIdhIHWGkoIhxdJLDgQ== X-Received: by 2002:a25:1b42:: with SMTP id b63-v6mr1606100ybb.98.1543503864552; Thu, 29 Nov 2018 07:04:24 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id r20sm2434656ywa.13.2018.11.29.07.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 07:04:24 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/4] drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state() Date: Thu, 29 Nov 2018 10:04:14 -0500 Message-Id: <20181129150423.239081-1-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , David Airlie , Sean Paul , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul 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 Signed-off-by: Sean Paul Reviewed-by: Daniel Vetter --- 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 fe8dd8aa4ae40..5e03bebc7f9e6 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3225,7 +3225,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; @@ -3244,7 +3244,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);