Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1460908lqp; Mon, 15 Apr 2024 07:15:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/vrvCm6doriLv6E6WMmZ09b/rxTp5FyeKwOMI3f3+hDmB6fvPeauxQ2lKUOTLmjvrhP231O1Oy+Wxc/MvlEyyLzDB55ENDnxtNz9F5g== X-Google-Smtp-Source: AGHT+IGsC0cTwfjIz/vl1Y/dsyOvCi+f17bJ/GMFNa+Rq1K4R0ihTEWef//uM4RKsiQQoZ9m/OO5 X-Received: by 2002:a05:6102:b10:b0:47b:814d:6abd with SMTP id b16-20020a0561020b1000b0047b814d6abdmr1918355vst.12.1713190547274; Mon, 15 Apr 2024 07:15:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713190547; cv=pass; d=google.com; s=arc-20160816; b=Hd0WiAbF55Vvrkgz1Ra7dTJzAIul+V+OQ+oX8ivViTWFZW9a1Uyjg9NBtuPd11DYY1 VPgYLQ9Kjh5M+29TeGvATNdvIEgcl+bFG+J7c+XNqRlG2NZnanS1wVWm8SoXoeXr74wi YR1QmLuX4nksfg+Y77ihMK6p/oGsfk3jxNKohQC5QGkHcCKBLbzT2vsAS0aHsCwWljHt z3LTvXatX0FUDaQKIIEVXjeD5DLmLJMzhxD2+svFlz9EaT4C3U8gcxpOcjSuoDTmE6tV VqsiHvnKyW+STGkD5tcdf5kWG5hEgCp9+boncnxwlvYzQWkE9m+LtXGfUCpsBfcCjAnZ JLyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=h6yFM9pgd0whttYbjAZoTcp9eapZWoc7Vu1vmPJ3kHs=; fh=6vQrkwhddbQimtnGsGRApiBs3xuyNAqd+I1uA1LTz5k=; b=e6PDISjQOThMlZqheTiX+U76h2e+LjMlkqTpkEljvP4sQYpSV6ep4JnkVqt3Rgofcw SY+PSSEfmLRQJ+CLh825nPUukS8Jh/Edui3nH2ryZ81ukHFR/xIhPeI7MvoSpm9V9Umf Ac/lCdrtiQwDY4rRaFyxXjFJRt8SE31IQPQp1arfgXoUp/KRZcJyWRBHV5+7aWg2GHeU jymHfgFxhDFbwE1C52WXvokGb+3aluUzI+rxDg5QQDSG9oAgW1V+n61rwfhA7ZMyRe+v XMELbt9Qh38VuR9pp5gwxzMYKDhBH9vGlCETXh6rbPIXa5AejW7O3DmGMHOffYeYYr+O WkeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Z9l1Q5Gq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/MHEA5ux"; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-145328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145328-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bm35-20020a056102512300b0047a4464b4d9si1197941vsb.274.2024.04.15.07.15.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 07:15:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Z9l1Q5Gq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/MHEA5ux"; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-145328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145328-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 031781C21E32 for ; Mon, 15 Apr 2024 14:15:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6364D74E0C; Mon, 15 Apr 2024 14:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Z9l1Q5Gq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/MHEA5ux" 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 032DB745C9 for ; Mon, 15 Apr 2024 14:15:38 +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=1713190540; cv=none; b=UvD7z1YmHH2QNbkBhSUPMjR+5+rn2asqCnV82mIppfH947387gmzJ4P00X+ISYjjfWbhhlZExOpX3WG/VmsJiT/tjT+k4unnoxkbp94o5O5WVEyAI9aCARJZfsnRUhFBH36u3Bf4oJ4tpG4ZfQbQDYBEotOOqWdtE00+myAQqCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713190540; c=relaxed/simple; bh=cjV08SRv2E8lVxHe/9QLozU/asPpH9Ux3oisMF5kEj4=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:MIME-Version: Content-Type; b=eNKeVg114TjU+5K+EcDiw/SxbaObDovEQ6uk0aSrxXjmAF49Sug3uiU+aK6iupO2JrmIIS8Bhk2JYbZVoHUqyj2mAm9TcFI2kwrwlgt/IQG9pgxur1HX30tTrJMJvxWfa4xC2rZm/QSuT86CHKxfWaZpvAO6v7ahE1MYNiR75cM= 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=Z9l1Q5Gq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/MHEA5ux; 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 From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713190535; 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: in-reply-to:in-reply-to; bh=h6yFM9pgd0whttYbjAZoTcp9eapZWoc7Vu1vmPJ3kHs=; b=Z9l1Q5GqxNi1rg9cmNKsTNq53wlwhNh9UonWGMtFn4xtvTVtZFLz+kondQcjSZ917HZRlL eh4bvISe/ajz6HtoTgVrq8ssr8xD8wmG9CsPZPmN7Od5PdeORjD5JY6O2rXtsf19OddiU3 gZs6fns5oLmgLRl+/T+uFCSWzhJSTtnQ10QFP9A1fuT2xJuh0el7cH+pykxg1nJ2oAHfx4 YYPhGok0VotgUhBQeVHFc4oN5NS1VwcyrXSOG5Om7I5pSG+RjOh5yPdxeCQEWEDFVEUQhW 4bdcG7eMmjb8GyvWcTU/rDoVmcxx//Dm6U1OhrXYlk5Yes9qGyKAKVfUAg//aw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713190535; 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: in-reply-to:in-reply-to; bh=h6yFM9pgd0whttYbjAZoTcp9eapZWoc7Vu1vmPJ3kHs=; b=/MHEA5uxwRHyEHyKqfdRiA0G9UnXHv3hGNZ3wslJ/cK+b8vVEK9qvhFvwiUPLroirYJTaP IpSXwgVhISkHY5CA== To: Oleg Nesterov Cc: Thomas Gleixner , LKML , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman Subject: Re: [PATCH] posix-timers: Handle returned errors poperly in [i]timer_delete() In-Reply-To: <20240415130023.GA27124@redhat.com> Date: Mon, 15 Apr 2024 16:15:34 +0200 Message-ID: <87a5luvhix.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Oleg Nesterov writes: > 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... This shouldn't happen, right. Even if we do not return this error to userspace, is it valid to proceed with the rest of the callsites? When it is fine to just ignore the -EINVAL return, then I would propose just to add a comment to the code. >> --- 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() ? > bah... was done in a hurry... Thanks, Anna-Maria