From nobody Sun Nov 24 16:26:08 2024 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 882E01D63D6 for ; Tue, 5 Nov 2024 08:14:32 +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=1730794474; cv=none; b=uyf8JthdPXbI37EI0wKRuRO+AjcPBFKm6rDrIFUQ/HLqbbKpzA6igEo76j6ubM+qM79hQmlOvSnT65UGaLkM+DJUIEtMhO4+SJxgoXJVNoAj/p6Tja7xPpYA36hox5+Xz4Mj0iUa9+ATf5fhdRIP5cnSby0l+mPSgRDZBW6upOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730794474; c=relaxed/simple; bh=d5QhPPnuwFRqvAZPc7n18otmDSMhVsX2cz6TUCAyzCA=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=OQ9WJjOk7+h2lkz7l+Szde1j+cOgUA+lH+I6PJcTyGEKP7t1iu/Eg+aYyTg41IznGEWfL5Sddt7uNIagCdBu87lv3rS1vdaTb6qXRASHZGccCAlDouTFJlx7i2rDPGc+kKTGyemZfY7mXCf0jT5TVgfwhufOvlsWeJ+nMbMCE1g= 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=3A/xdnK2; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0K/x4L58; 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="3A/xdnK2"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0K/x4L58" Message-ID: <20241105064212.974053438@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730794470; 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: references:references; bh=v3QgMEUqhJ+KNqE09QiLEnjnbzGnnD0fCdI08LxtvpE=; b=3A/xdnK2E5j2HsHAZnjzUhiQPQ/jx80yleOGjchV/bcbsu5qnk3L85amIEk+4nbahQMzsu Ip0oX5CsbuAIqG7WL1xxrkbOZS+XLVUv1Qy+dkfvYAMf3RaKMQB2HuMV3Y5NdBZDMGYkE3 lT3VFBzmbdKQ9AD23w96qEXu00w9Pm0XzQBt+GqxodBjFgfNxPofxKDGsIxGtXAiIu+OCe mwcQK6vCnBKebXWnLd42waR9+ks8NEUEtNlrzVSGsSybxwExaCIaxKW2EsJdZ1LzmrcAUl DLF7G22zExXLmAQKH0LV94i6zcsmOLtVyh/JyDEudRdwTaZF1ZJ4YNmNtL3hmw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730794470; 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: references:references; bh=v3QgMEUqhJ+KNqE09QiLEnjnbzGnnD0fCdI08LxtvpE=; b=0K/x4L58B5XfFD57A7Cm8R8wFOviZbZpdJxYVTbWaWAo5PbPzMIPyE4oKIZmaUW1rud0JL QSu4WdJa66avLJAg== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V7 01/21] posix-cpu-timers: Correctly update timer status in posix_cpu_timer_del() References: <20241105063544.565410398@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 5 Nov 2024 09:14:29 +0100 (CET) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If posix_cpu_timer_del() exits early due to task not found or sighand invalid, it fails to clear the state of the timer. That's harmless but inconsistent. These early exits are accounted as successful delete. Move the update of the timer state into the success return path, so all "successful" deletions are handled. Reported-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- V7: New patch --- kernel/time/posix-cpu-timers.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -493,20 +493,20 @@ static int posix_cpu_timer_del(struct k_ */ WARN_ON_ONCE(ctmr->head || timerqueue_node_queued(&ctmr->node)); } else { - if (timer->it.cpu.firing) { + if (timer->it.cpu.firing) ret =3D TIMER_RETRY; - } else { + else disarm_timer(timer, p); - timer->it_status =3D POSIX_TIMER_DISARMED; - } unlock_task_sighand(p, &flags); } =20 out: rcu_read_unlock(); - if (!ret) - put_pid(ctmr->pid); =20 + if (!ret) { + put_pid(ctmr->pid); + timer->it_status =3D POSIX_TIMER_DISARMED; + } return ret; }