From nobody Wed Apr 1 20:46:28 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E54D73AB26B; Wed, 1 Apr 2026 15:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775056584; cv=none; b=XllRvQW3lw7kJhQLqQe1ePChHEj3S+izZqUf1ROlHqwZL8wAAlJcauZydcF22lfyDTbnEqoMwEc2k56qHOC51i2zN7i9h8Pv0wjfjZXhNBlKpqUrsyI2x4aIVLAdULd6IUzuSCRjjUMfFsJXih4xpy9s42gf3dhJRwWpqYNsDwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775056584; c=relaxed/simple; bh=Nfj93nSA5Dp4WpPJC94hTUrOE7EDbeUZws7he9DscVw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=QVdYZu/IQFZZIVNKrxTOdgYgV0vNjryJB1VYIOXkivAtB6OTrUCzhFy+lYGrkkGicGjCit9Mkq9K7ie+TN6TplLawPLvyb4y/Gd1spatZWU//e7zayZORG7jPefJx74lf7i+hXUklycHmtIjiRMssF9HZmW5DECR1G7MGs95wW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=20kLxcu3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uc/qg+av; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="20kLxcu3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uc/qg+av" Date: Wed, 01 Apr 2026 15:16:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1775056581; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vwYd0HCyfFl9mElO8kPydYstIRWGRlRfx0twRON+OCg=; b=20kLxcu38j1ruM+oUjrwoIuQYjSND+u9yu0CotOUqL/E0p1LDfxA3U4/3fhyReb2hY6m5n KUD7i9xLwrqGpfqtjfKynDWjawrgoJc8GDAEPDJCRjwPHs/iB2rz46vqaNDvSSoov2WpDa vmtk9ITBXwHrWlb8imdzoDtw8UA9O/cCVmaKEhxEJGhPrTHUHrzO4V/TXAOtG/oOn26Neu 9AfEfPJgZpoS8zrZWR014fMuK6/CYiApMGEAty/ZWehdOfklaI1U2P7/tUKAayB8yzrzCg H93AodkV8Kgq6JGQtpo6YxTslwe3uK7V5deCUYrA+M6+FYfC/9KH3OH4r5NPLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1775056581; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vwYd0HCyfFl9mElO8kPydYstIRWGRlRfx0twRON+OCg=; b=uc/qg+avtpeaWncx8mJXLyNYAd2E2XNVvmay20xqKKF0SvbIDXpjFQUSvcyVRNP2L0v/Xd kyymrQ3dZKjRLUCw== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/vdso] timens: Simplify some calls to put_time_ns() Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260330-timens-cleanup-v1-2-936e91c9dd30@linutronix.de> References: <20260330-timens-cleanup-v1-2-936e91c9dd30@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177505658043.1647592.3870412071820971815.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/vdso branch of tip: Commit-ID: 3fa3aeb4a5cb19e372680ef8860a0381cd5409e9 Gitweb: https://git.kernel.org/tip/3fa3aeb4a5cb19e372680ef8860a0381c= d5409e9 Author: Thomas Wei=C3=9Fschuh AuthorDate: Mon, 30 Mar 2026 09:07:56 +02:00 Committer: Thomas Gleixner CommitterDate: Wed, 01 Apr 2026 17:13:35 +02:00 timens: Simplify some calls to put_time_ns() Use the new __free() based cleanup helpers to simplify some functions. Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260330-timens-cleanup-v1-2-936e91c9dd30@li= nutronix.de --- kernel/time/namespace.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c index 42302cc..37495bd 100644 --- a/kernel/time/namespace.c +++ b/kernel/time/namespace.c @@ -18,6 +18,7 @@ #include #include #include +#include =20 #include "namespace_internal.h" =20 @@ -251,36 +252,33 @@ static void show_offset(struct seq_file *m, int clock= id, struct timespec64 *ts) =20 void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m) { - struct ns_common *ns; - struct time_namespace *time_ns; + struct time_namespace *time_ns __free(time_ns) =3D NULL; + struct ns_common *ns =3D timens_for_children_get(p); =20 - ns =3D timens_for_children_get(p); if (!ns) return; + time_ns =3D to_time_ns(ns); =20 show_offset(m, CLOCK_MONOTONIC, &time_ns->offsets.monotonic); show_offset(m, CLOCK_BOOTTIME, &time_ns->offsets.boottime); - put_time_ns(time_ns); } =20 int proc_timens_set_offset(struct file *file, struct task_struct *p, struct proc_timens_offset *offsets, int noffsets) { - struct ns_common *ns; - struct time_namespace *time_ns; + struct time_namespace *time_ns __free(time_ns) =3D NULL; + struct ns_common *ns =3D timens_for_children_get(p); struct timespec64 tp; int i, err; =20 - ns =3D timens_for_children_get(p); if (!ns) return -ESRCH; + time_ns =3D to_time_ns(ns); =20 - if (!file_ns_capable(file, time_ns->user_ns, CAP_SYS_TIME)) { - put_time_ns(time_ns); + if (!file_ns_capable(file, time_ns->user_ns, CAP_SYS_TIME)) return -EPERM; - } =20 for (i =3D 0; i < noffsets; i++) { struct proc_timens_offset *off =3D &offsets[i]; @@ -293,15 +291,12 @@ int proc_timens_set_offset(struct file *file, struct = task_struct *p, ktime_get_boottime_ts64(&tp); break; default: - err =3D -EINVAL; - goto out; + return -EINVAL; } =20 - err =3D -ERANGE; - if (off->val.tv_sec > KTIME_SEC_MAX || off->val.tv_sec < -KTIME_SEC_MAX) - goto out; + return -ERANGE; =20 tp =3D timespec64_add(tp, off->val); /* @@ -309,7 +304,7 @@ int proc_timens_set_offset(struct file *file, struct ta= sk_struct *p, * still unreachable. */ if (tp.tv_sec < 0 || tp.tv_sec > KTIME_SEC_MAX / 2) - goto out; + return -ERANGE; } =20 mutex_lock(&timens_offset_lock); @@ -338,8 +333,6 @@ int proc_timens_set_offset(struct file *file, struct ta= sk_struct *p, =20 out_unlock: mutex_unlock(&timens_offset_lock); -out: - put_time_ns(time_ns); =20 return err; }