mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cgroup/cpuset: Fix retval in update_cpumask()
@ 2024-02-29 10:11 Kamalesh Babulal
  2024-02-29 14:24 ` Waiman Long
  2024-02-29 20:38 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Kamalesh Babulal @ 2024-02-29 10:11 UTC (permalink / raw)
  To: Waiman Long; +Cc: Zefan Li, Tejun Heo, Tom Hromatka, cgroups, linux-kernel

The update_cpumask(), checks for newly requested cpumask by calling
validate_change(), which returns an error on passing an invalid set
of cpu(s). Independent of the error returned, update_cpumask() always
returns zero, suppressing the error and returning success to the user
on writing an invalid cpu range for a cpuset. Fix it by returning
retval instead, which is returned by validate_change().

Fixes: 99fe36ba6fc1 ("cgroup/cpuset: Improve temporary cpumasks handling")
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
---
 kernel/cgroup/cpuset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index ba36c073304a..2ddbfaa4efa9 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2562,7 +2562,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
 		update_partition_sd_lb(cs, old_prs);
 out_free:
 	free_cpumasks(NULL, &tmp);
-	return 0;
+	return retval;
 }
 
 /**

base-commit: cf1182944c7cc9f1c21a8a44e0d29abe12527412
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup/cpuset: Fix retval in update_cpumask()
  2024-02-29 10:11 [PATCH] cgroup/cpuset: Fix retval in update_cpumask() Kamalesh Babulal
@ 2024-02-29 14:24 ` Waiman Long
  2024-02-29 20:38 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Waiman Long @ 2024-02-29 14:24 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: Zefan Li, Tejun Heo, Tom Hromatka, cgroups, linux-kernel


On 2/29/24 05:11, Kamalesh Babulal wrote:
> The update_cpumask(), checks for newly requested cpumask by calling
> validate_change(), which returns an error on passing an invalid set
> of cpu(s). Independent of the error returned, update_cpumask() always
> returns zero, suppressing the error and returning success to the user
> on writing an invalid cpu range for a cpuset. Fix it by returning
> retval instead, which is returned by validate_change().
>
> Fixes: 99fe36ba6fc1 ("cgroup/cpuset: Improve temporary cpumasks handling")
> Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
> ---
>   kernel/cgroup/cpuset.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index ba36c073304a..2ddbfaa4efa9 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2562,7 +2562,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
>   		update_partition_sd_lb(cs, old_prs);
>   out_free:
>   	free_cpumasks(NULL, &tmp);
> -	return 0;
> +	return retval;
>   }
>   
>   /**
>
> base-commit: cf1182944c7cc9f1c21a8a44e0d29abe12527412

LGTM, thanks for the fix.

Reviewed-by: Waiman Long <longman@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup/cpuset: Fix retval in update_cpumask()
  2024-02-29 10:11 [PATCH] cgroup/cpuset: Fix retval in update_cpumask() Kamalesh Babulal
  2024-02-29 14:24 ` Waiman Long
@ 2024-02-29 20:38 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2024-02-29 20:38 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: Waiman Long, Zefan Li, Tom Hromatka, cgroups, linux-kernel

On Thu, Feb 29, 2024 at 03:41:14PM +0530, Kamalesh Babulal wrote:
> The update_cpumask(), checks for newly requested cpumask by calling
> validate_change(), which returns an error on passing an invalid set
> of cpu(s). Independent of the error returned, update_cpumask() always
> returns zero, suppressing the error and returning success to the user
> on writing an invalid cpu range for a cpuset. Fix it by returning
> retval instead, which is returned by validate_change().
> 
> Fixes: 99fe36ba6fc1 ("cgroup/cpuset: Improve temporary cpumasks handling")
> Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>

Applied to cgroup/for-6.8-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-29 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 10:11 [PATCH] cgroup/cpuset: Fix retval in update_cpumask() Kamalesh Babulal
2024-02-29 14:24 ` Waiman Long
2024-02-29 20:38 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®