From patchwork Fri Mar 8 20:11:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1909850 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Try644XBhz1yWx for ; Sat, 9 Mar 2024 07:13:16 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rigaT-0007WB-45; Fri, 08 Mar 2024 20:13:01 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rigZQ-0007Da-D0 for kernel-team@lists.ubuntu.com; Fri, 08 Mar 2024 20:11:56 +0000 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 10A6348A9D for ; Fri, 8 Mar 2024 20:11:56 +0000 (UTC) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6906e9a4d64so35059016d6.0 for ; Fri, 08 Mar 2024 12:11:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709928714; x=1710533514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=07pK8krJgGqAZ4WcK5B8MXWi1cxj50wmQG6svjYHWMI=; b=EIKErNEYALWmEQuxpgTtbP3rBYJdlm+wZTNXgm+pq2jTmgBFQVdi3X7RpBGRrrkmsF P/9ybVaU2/WkuWcN6OGhI8WdP795SyQv92bWrHP6VgiPEyf6In/XzsIDD+0gqfsfI3i2 VQr+GDDyFnRJPHeVrtbRBNaYzs0AyjEWoOAn501BXYoATVWraxgdFy9/9tN8sMfXApl/ y8RPJgVFwqXq1vL2XHNGEZVnD4JvesqL5vuE8YOZo/cVUWR/Qq23Og66sC1eHcMeEM0D 33hBFvaQovyrFzUnRAaNqMXU6Z5QaZ6mJbSsnMZdpOnRQMyo+TDYszCJfIkwn06rBfJZ 98uQ== X-Gm-Message-State: AOJu0Yy+mGqKRdA2IESDtSCQwYxwxKTUXgVh1o+umamGP6/QaR4JvAfg AH+ICSeBdhEe6LaPKZvMr6tarO2EGrktnYUvVHu/mSKVsH3KDT5S7PIEImLl1GZ1j+xnvzZ2utx Lor5/waLPJgKhH40YMvlwe6VdEaUuNzhiyNf974l8+07+kaD3dG2NscDfcwg5o39ggzgbXDbb2v zygHmGqRmzpg== X-Received: by 2002:a05:6214:5841:b0:690:b0e3:707f with SMTP id ml1-20020a056214584100b00690b0e3707fmr156824qvb.37.1709928714490; Fri, 08 Mar 2024 12:11:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq4qTian1ILdhFq4rVFEnnBIAHkGM+xjOliPlb8Lx+UxYMWS1SxAufKj6DhU5hx3BkkFlaHg== X-Received: by 2002:a05:6214:5841:b0:690:b0e3:707f with SMTP id ml1-20020a056214584100b00690b0e3707fmr156806qvb.37.1709928714172; Fri, 08 Mar 2024 12:11:54 -0800 (PST) Received: from smtp.gmail.com (104-218-69-129.dynamic.lnk.ne.allofiber.net. [104.218.69.129]) by smtp.gmail.com with ESMTPSA id el18-20020ad459d2000000b0069044802760sm64238qvb.120.2024.03.08.12.11.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 12:11:53 -0800 (PST) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][F][PATCH v2 4/7] drm/gem: add drm_gem_object_put helper Date: Fri, 8 Mar 2024 14:11:47 -0600 Message-Id: <20240308201150.25987-5-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308201150.25987-1-bethany.jamison@canonical.com> References: <20240308201150.25987-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Emil Velikov Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex. Add helper, which will allow us to transition the drivers one by one, dropping the suffix. v2: add missing space after function name (Jani) Signed-off-by: Emil Velikov Acked-by: Sam Ravnborg (v1) Reviewed-by: Steven Price Acked-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20200515095118.2743122-13-emil.l.velikov@gmail.com (cherry picked from commit 2f4dd13d4bb8a85f6d5b66a18989509924e4f5e9) CVE-2023-39198 Signed-off-by: Bethany Jamison --- include/drm/drm_gem.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 585addb0cd1c..8c9a2748acd8 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -350,17 +350,19 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) } /** - * drm_gem_object_put_unlocked - drop a GEM buffer object reference + * drm_gem_object_put - drop a GEM buffer object reference * @obj: GEM buffer object * * This releases a reference to @obj. */ static inline void -drm_gem_object_put_unlocked(struct drm_gem_object *obj) +drm_gem_object_put(struct drm_gem_object *obj) { kref_put(&obj->refcount, drm_gem_object_free); } +#define drm_gem_object_put_unlocked drm_gem_object_put + void drm_gem_object_put_locked(struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,