From patchwork Tue Feb 20 19:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1901643 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 4TfTrJ1tLCz1yP6 for ; Wed, 21 Feb 2024 06:25:04 +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 1rcVjV-0008Kx-Vq; Tue, 20 Feb 2024 19:24:50 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rcVjM-0008EO-DL for kernel-team@lists.ubuntu.com; Tue, 20 Feb 2024 19:24:40 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (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-0.canonical.com (Postfix) with ESMTPS id 31BF63F83F for ; Tue, 20 Feb 2024 19:24:40 +0000 (UTC) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1dc1db2fb48so7847105ad.0 for ; Tue, 20 Feb 2024 11:24:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708457078; x=1709061878; 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=9Pmt0BEubYQw0G1SFAbry/PDi5nK2/kzfMBz7hxVVt8=; b=eSjkT+CUleTvm+QmzP0Y30jqFtzXDu8o4iaJYSN3HcOnqE/Rt8v6IhttaNSabloUE7 XsoajX5UWQLmz8TI5vqRV8nhDD7/VobQoVnmDJyUcAKgKm71zNFtxDx2tn8pbM2OJQBr lVSGD6R2dkq6tNW140A6VH6jMErP7LOsrcjZm5EbnOOCbpLdOQ8qIEO4PmGSdKEnMb7a o/xfoh3Q4vl6z5SiZ0HyGAFk8EMa7PnklMrgFCWwdOe3MfjBdRtHC63KJDWkhQnZIjkc SUM26ghTE742lk3FbBu56Bliu34KwfbWdF7f01DrVEhhTlZtXYfTC0jMzK9fCYj8hSOm HttA== X-Gm-Message-State: AOJu0Yx5hXbGvpZNNYf8UwfEYSJ6xHAvs/V1UQXEUf+wndQdo66V6qDD K2G+mGCHFwTDq0ff0DTHkYVrbKI8/VcgdA+2psZ51PJX5Derq8ccZ1qzqiWNTC8etcd5M0vjtX1 X50QIG6aU1Zs7XwJLHKyMCzfmEoqkjAL6zoRhprnCyfqZdI8NGJoCR1dzvwdeteg3GMQZuzVtxR LZQQy22K65dw== X-Received: by 2002:a17:902:684a:b0:1db:730c:c077 with SMTP id f10-20020a170902684a00b001db730cc077mr14052699pln.58.1708457078405; Tue, 20 Feb 2024 11:24:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHej3gIdq7ykxBlM9w0fQnZ87zmc5w/2SmNuQ5Y0NTH5v25aBqAX4lpmOPd8OcOPv+bQm+0Og== X-Received: by 2002:a17:902:684a:b0:1db:730c:c077 with SMTP id f10-20020a170902684a00b001db730cc077mr14052693pln.58.1708457078008; Tue, 20 Feb 2024 11:24:38 -0800 (PST) Received: from cache-ubuntu.hsd1.nj.comcast.net ([2001:67c:1562:8007::aac:4795]) by smtp.gmail.com with ESMTPSA id l21-20020a170902e2d500b001d9fcd343edsm6639440plc.208.2024.02.20.11.24.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 11:24:37 -0800 (PST) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-6.1][PATCH 4/8] timers: Rename del_timer() to timer_delete() Date: Tue, 20 Feb 2024 14:24:17 -0500 Message-Id: <20240220192421.35003-5-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220192421.35003-1-yuxuan.luo@canonical.com> References: <20240220192421.35003-1-yuxuan.luo@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: Thomas Gleixner The timer related functions do not have a strict timer_ prefixed namespace which is really annoying. Rename del_timer() to timer_delete() and provide del_timer() as a wrapper. Document that del_timer() is not for new code. Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Steven Rostedt (Google) Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201625.015535022@linutronix.de (backported from commit bb663f0f3c396c6d05f6c5eeeea96ced20ff112e) [yuxuan.luo: ignored the conflict and added the new content] CVE-2023-6039 Signed-off-by: Yuxuan Luo --- include/linux/timer.h | 15 ++++++++++++++- kernel/time/timer.c | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index 6d18f04ad703..d5aaf3a7adf0 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -169,7 +169,6 @@ static inline int timer_pending(const struct timer_list * timer) } extern void add_timer_on(struct timer_list *timer, int cpu); -extern int del_timer(struct timer_list * timer); extern int mod_timer(struct timer_list *timer, unsigned long expires); extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); extern int timer_reduce(struct timer_list *timer, unsigned long expires); @@ -184,6 +183,7 @@ extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); extern int timer_delete_sync(struct timer_list *timer); +extern int timer_delete(struct timer_list *timer); /** * del_timer_sync - Delete a pending timer and wait for a running callback @@ -200,6 +200,19 @@ static inline int del_timer_sync(struct timer_list *timer) #define del_singleshot_timer_sync(t) del_timer_sync(t) +/** + * del_timer - Delete a pending timer + * @timer: The timer to be deleted + * + * See timer_delete() for detailed explanation. + * + * Do not use in new code. Use timer_delete() instead. + */ +static inline int del_timer(struct timer_list *timer) +{ + return timer_delete(timer); +} + extern void init_timers(void); struct hrtimer; extern enum hrtimer_restart it_real_fn(struct hrtimer *); diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 59469897432b..63d5f94fb7c1 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1255,7 +1255,7 @@ void add_timer_on(struct timer_list *timer, int cpu) EXPORT_SYMBOL_GPL(add_timer_on); /** - * del_timer - Deactivate a timer. + * timer_delete - Deactivate a timer * @timer: The timer to be deactivated * * The function only deactivates a pending timer, but contrary to @@ -1268,7 +1268,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -int del_timer(struct timer_list *timer) +int timer_delete(struct timer_list *timer) { struct timer_base *base; unsigned long flags; @@ -1284,7 +1284,7 @@ int del_timer(struct timer_list *timer) return ret; } -EXPORT_SYMBOL(del_timer); +EXPORT_SYMBOL(timer_delete); /** * try_to_del_timer_sync - Try to deactivate a timer