From nobody Mon Apr 6 11:59:23 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 04D8F1B4F0A for ; Mon, 30 Mar 2026 07:09:17 +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=1774854559; cv=none; b=Dh9UnI9HLvbEienCDJ461zSyls1ohedMAX+UKX/bPMsm11rBnPlPUw8leALtjliwdBYoiEaWRHsoDHCWMlUSm67jab9xcsdmqpcgIilq5sWBwgM/L0Yc4WDu7z5sb++suXp8PCGlJR2kE05EcjFNzfF5ZLAK5XbfAG1brITk7cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774854559; c=relaxed/simple; bh=RMi4toWB8rANPuRlGR/U3Ylpn46UH18qARWQgNaNc5w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hBQAQFXqzoa7HWnKx9GTgyR9EYVi5THTc32MMdPktcUSMIHvnsu3aMoI+OlCsuiWC8d3YD646txkDqx6ni5Y7mAlePnMRvn62mRFC01l7rsCx/gtGW+OLFN5yXTqkGpNZVR4imsGzi405sLNHM6+PLkCUatBBSltxP9R7ThcOd4= 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=fnoHweYl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PhN3DIzv; 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="fnoHweYl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PhN3DIzv" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774854556; h=from:from: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=ppYCVW3xdyWu4fiIVU8bl2UHAp4HeSZWcfGNTKcTgZI=; b=fnoHweYlm6kBox4HUIJHQfc3j6yLPzIDCFxB9RdUnwMyfoZa+Ud/T9vXb3NFnq3a58lt50 EEdlOxS16ujlU51E0yMrsKoRB9STkS/KKgWtqlPvM6+rK6eQz1eg9+wnAnBjeaHDG5qq3b FqGj6sSQRW5ObV2t7yIitRkvkXhds8hiOgz7IxdLoA3mmOmZgrbp6M2RMLJpNFnhNPckAE kEcshiSlZLfCRu7okj7kkC18PWwLbGe3hPXJdauIabksw+VR5WP6HhCMxDISybmFc76lHr O2XDxk4XmKMg9ON7nwQfI3ZULYmc5xoI/8anLYkiCE9PE3W7vTXNRGwITswtWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774854556; h=from:from: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=ppYCVW3xdyWu4fiIVU8bl2UHAp4HeSZWcfGNTKcTgZI=; b=PhN3DIzv6ieMlAGSbLlpbrnnl3c/ErgnWBkLJq4sNRXhlhrIHXsQH05f7v3FcRht6oZYta S63LNEKef/s2+rDg== Date: Mon, 30 Mar 2026 09:07:56 +0200 Subject: [PATCH 2/4] timens: Simplify some calls to put_time_ns() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260330-timens-cleanup-v1-2-936e91c9dd30@linutronix.de> References: <20260330-timens-cleanup-v1-0-936e91c9dd30@linutronix.de> In-Reply-To: <20260330-timens-cleanup-v1-0-936e91c9dd30@linutronix.de> To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1774854554; l=2777; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=RMi4toWB8rANPuRlGR/U3Ylpn46UH18qARWQgNaNc5w=; b=5jHpcf13Q3Og8xKg3yVVvwuIdu64fzxE4Sai8SM99bjUBSS/k5mx2PILHWSRLJuZIkIKpKyxY pNVTXD73sWkCui9t5CJ1sevi7VQz88aQfRZTRe22aSEV45nLsC+4Z0r X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Use the new __free() based cleanup helpers to simplify some functions. Signed-off-by: Thomas Wei=C3=9Fschuh --- kernel/time/namespace.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c index 42302cc3f3fb..ae9a3a5d53ab 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 @@ -252,7 +253,7 @@ static void show_offset(struct seq_file *m, int clockid= , struct timespec64 *ts) 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; =20 ns =3D timens_for_children_get(p); if (!ns) @@ -261,14 +262,13 @@ void proc_timens_show_offsets(struct task_struct *p, = struct seq_file *m) =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 timespec64 tp; int i, err; =20 @@ -277,10 +277,8 @@ int proc_timens_set_offset(struct file *file, struct t= ask_struct *p, 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; } --=20 2.53.0