[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240415130023.GA27124@redhat.com>
Date: Mon, 15 Apr 2024 15:00:24 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Anna-Maria Behnsen <anna-maria@...utronix.de>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <frederic@...nel.org>,
John Stultz <jstultz@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>
Subject: Re: [PATCH] posix-timers: Handle returned errors poperly in
[i]timer_delete()
On 04/15, Anna-Maria Behnsen wrote:
>
> timer_delete_hook() returns -EINVAL when the clock or the timer_del
> callback of the clock does not exist. This return value is not handled by
> the callsites timer_delete() and itimer_delete().
IIUC this shouldn't happen? timer_delete_hook() WARN()s in this case,
not sure we need to return this error to userspace...
> --- a/kernel/time/posix-timers.c
> +++ b/kernel/time/posix-timers.c
> @@ -1009,6 +1009,7 @@ SYSCALL_DEFINE1(timer_delete, timer_t, t
> {
> struct k_itimer *timer;
> unsigned long flags;
> + int ret;
>
> timer = lock_timer(timer_id, &flags);
>
> @@ -1019,7 +1020,11 @@ SYSCALL_DEFINE1(timer_delete, timer_t, t
> /* Prevent signal delivery and rearming. */
> timer->it_signal_seq++;
>
> - if (unlikely(timer_delete_hook(timer) == TIMER_RETRY)) {
> + ret = timer_delete_hook(timer);
> + if (ret < 0)
> + return ret;
unlock_timer() ?
> static void itimer_delete(struct k_itimer *timer)
> {
> unsigned long flags;
> + int ret;
>
> /*
> * irqsave is required to make timer_wait_running() work.
> @@ -1054,13 +1060,17 @@ static void itimer_delete(struct k_itime
> spin_lock_irqsave(&timer->it_lock, flags);
>
> retry_delete:
> + ret = timer_delete_hook(timer);
> + if (WARN_ON_ONCE(ret < 0))
> + return;
the same.
Oleg.
Powered by blists - more mailing lists