From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 262D04C77A4; Sat, 28 Feb 2026 17:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300096; cv=none; b=CeOMfPkxKqL2nXz/htS9+7FVPmmVcBCSbzKMHweVTkPlHEjBx7goS9ikeOVYazbTS0KplOG+iLZ+86kbq1XYqzGKOqzSjJEOlomWQFwVGtGLZoSkAdqQusZZ2ZK9jylM9dfT6pPeSgD2dmAYNkQsVY1MvkyUPm/B/QL+kigsRtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300096; c=relaxed/simple; bh=j5xNUslQNcpWHSQ8UAeGt65hKPEGFjMUP9W6SWona0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Og9RIjPfIvwtO6RLciUnvfit7853EUo4vboLfha4s3MyTPJHMwJnsLwohGY9wL7AhicPPrGaS+pE5VkTvN6Vn47N1BDm/J5gETSba1IaJpKRA7kP+k5+rGFiHFNKBQn2mr2JiMsM2/HhUuC5gpkp9fqwchdacJ4/55UDcpE+rwE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=prfp3rQy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="prfp3rQy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E34C19424; Sat, 28 Feb 2026 17:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300096; bh=j5xNUslQNcpWHSQ8UAeGt65hKPEGFjMUP9W6SWona0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=prfp3rQyWBg4CiVOeoBb57Bacl0RPu7pFpB9aK+B4OzVXNgoHPH9XfcIlq0kxfbx9 gP8C3ZwdhULXfwYr4NL4BKVJQ7cIqCNhD0Luiek96u0XevuSY+kTaFI+eFteMN8PAP XaNe73c7Di/sB6jme/L3fvRGjKLyeCBBrJ2N1wm2gbYaamMSuNs/KXU8TTcWmQy7H9 JqId5Obp07oL0QsLHCUuY8tg5gaFpNMLmUl59EAwRXZEp/9VC0ZEZaoV0hZLwaDwx0 mcLlp05aDVaCWPG1pmzDt8EbB2Et559stujr8yWh0V43RQZ+GXWOFvo2nD5vzDOYju 9AkCyynI9qB1Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Joel Fernandes , "Peter Zijlstra (Intel)" , Juri Lelli , Andrea Righi , Tejun Heo , Christian Loehle , Sasha Levin Subject: [PATCH 6.19 111/844] sched/debug: Fix updating of ppos on server write ops Date: Sat, 28 Feb 2026 12:20:24 -0500 Message-ID: <20260228173244.1509663-112-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Joel Fernandes [ Upstream commit 6080fb211672aec6ce8f2f5a2e0b4eae736f2027 ] Updating "ppos" on error conditions does not make much sense. The pattern is to return the error code directly without modifying the position, or modify the position on success and return the number of bytes written. Since on success, the return value of apply is 0, there is no point in modifying ppos either. Fix it by removing all this and just returning error code or number of bytes written on success. Signed-off-by: Joel Fernandes Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Juri Lelli Reviewed-by: Andrea Righi Acked-by: Tejun Heo Tested-by: Christian Loehle Link: https://patch.msgid.link/20260126100050.3854740-3-arighi@nvidia.com Signed-off-by: Sasha Levin --- kernel/sched/debug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 41caa22e0680a..93f009e1076d8 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -345,8 +345,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu long cpu = (long) ((struct seq_file *) filp->private_data)->private; struct rq *rq = cpu_rq(cpu); u64 runtime, period; + int retval = 0; size_t err; - int retval; u64 value; err = kstrtoull_from_user(ubuf, cnt, 10, &value); @@ -380,8 +380,6 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu dl_server_stop(&rq->fair_server); retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0); - if (retval) - cnt = retval; if (!runtime) printk_deferred("Fair server disabled in CPU %d, system may crash due to starvation.\n", @@ -389,6 +387,9 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu if (rq->cfs.h_nr_queued) dl_server_start(&rq->fair_server); + + if (retval < 0) + return retval; } *ppos += cnt; -- 2.51.0