From patchwork Thu Jul 22 09:29:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Desmond Cheong Zhi Xi X-Patchwork-Id: 12393603 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=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham 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 94FDFC6377D for ; Thu, 22 Jul 2021 09:30:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62C396120C for ; Thu, 22 Jul 2021 09:30:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62C396120C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C37F46EE6D; Thu, 22 Jul 2021 09:30:06 +0000 (UTC) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by gabe.freedesktop.org (Postfix) with ESMTPS id 413C76EE6D; Thu, 22 Jul 2021 09:30:05 +0000 (UTC) Received: by mail-pj1-x1032.google.com with SMTP id nt18-20020a17090b2492b02901765d605e14so3685821pjb.5; Thu, 22 Jul 2021 02:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hdUv+GXySeA885YGpZmLXS+2jizmvcJ4lSDniuXWHI4=; b=EhYdQIseNy6lMDk8YjKQ1veyCiTbOgIoJ/VBVn2vLDHGjdPFhTNSRUWUK0bPWotrpJ XSI48OOBzprocJPN7b707Qc5XV1f9dLIpRoM7q+PNMy9LwG20xJmvNbKcGSK6p/43ngv jDxmxG5TXCq5VK530lsn/vAQrKCaKcQpM7lW3d1Fq/JexqDaA+V87C8Xhqbqp1A/6NrL WmSWXzObWM7UDCKqx7X0RGvebf9a9LFGYQcEiQtpFff0ndaFx1/emvMQExqEB3bVyCHs Z5PVVvZNWxv6xwAeBz0zwPyunJkYBvTruohXRBUZOy/c20hg9bs5aXsGxSpOS4Gj/5oz L9OA== 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=hdUv+GXySeA885YGpZmLXS+2jizmvcJ4lSDniuXWHI4=; b=Z3PE28vwqtIhUPrhVumQTrKOrOyhtzhMOseOfMiYScNgn3GHa1b1bUiebypLD0wi15 SneK1iPW9EQXhUAXw5QxvxsISzJajO3rpWCxMmxIs411ZskoPLYjimJKbazLbeh1W0x3 VU+x0rbqcvthh8hL0pJnudVRT4w/885SlIUaKgJ7CwRUMWNSplqUEQpxo9XDMo0b2Xsc BL7bsybEM3C7j5KCsG3JK44uQiK285qvhyngKBjl7fJDgKfMhsS4VZhydVUKwuph20hE H7a6y7HS2C9ya/mOGEDIJlD7LjfHADawH+KgK6LIWC5F9DtUghMJUw8iiccYAApq5dyQ 588A== X-Gm-Message-State: AOAM532rB8cZdGf6KFRjGsd61hMLRIqWHqIG9ffO3AhAEfqjGnf4xbUh P9mJANXnPW5GL1Pqoh60ueE= X-Google-Smtp-Source: ABdhPJzNOnM2Xiyy747iVpPkppzdexY5XMa3HjOqEYwbnOjXK0DTZlH0ZcQCcNQf3tlBT+6SeQX2yA== X-Received: by 2002:a63:e250:: with SMTP id y16mr40565172pgj.247.1626946204761; Thu, 22 Jul 2021 02:30:04 -0700 (PDT) Received: from localhost.localdomain ([118.200.190.93]) by smtp.gmail.com with ESMTPSA id q5sm1069592pjo.7.2021.07.22.02.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:30:04 -0700 (PDT) From: Desmond Cheong Zhi Xi To: linux-graphics-maintainer@vmware.com, zackr@vmware.com, airlied@linux.ie, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de Subject: [PATCH 0/3] drm, drm/vmwgfx: fixes and updates related to drm_master Date: Thu, 22 Jul 2021 17:29:26 +0800 Message-Id: <20210722092929.244629-1-desmondcheongzx@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, skhan@linuxfoundation.org, Desmond Cheong Zhi Xi , linux-kernel-mentees@lists.linuxfoundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi, This series contains some improvements that Daniel Vetter proposed following a discussion on a recent series: https://lore.kernel.org/lkml/20210712043508.11584-1-desmondcheongzx@gmail.com/ While preparing these patches, I also noticed some unprotected uses of drm_master in the vmwgfx driver that can be addressed by new functions from the previous series. This series is thus broken up into three patches: 1. Switch from the outer drm_device.master_mutex to the inner drm_file.master_lookup_lock in drm_is_current_master. 2. Update the kerneldoc for lease fields in drm_master to clarify lifetime/locking rules. 3. Prevent potential use-after-free bugs by replacing calls to drm_master_get with drm_file_get_master in vmwgfx_surface.c. Best wishes, Desmond Desmond Cheong Zhi Xi (3): drm: use the lookup lock in drm_is_current_master drm: clarify lifetime/locking for drm_master's lease fields drm/vmwgfx: fix potential UAF in vmwgfx_surface.c drivers/gpu/drm/drm_auth.c | 9 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +- include/drm/drm_auth.h | 62 ++++++++++++++++++++----- 3 files changed, 58 insertions(+), 17 deletions(-)