mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] cgroup: Check for ret during cgroup1_base_files cft addition
@ 2023-09-12  7:04 Kamalesh Babulal
  2023-09-12  7:04 ` [PATCH 2/2] cgroup: Avoid extra dereference in css_populate_dir() Kamalesh Babulal
  2023-09-18 18:57 ` [PATCH 1/2] cgroup: Check for ret during cgroup1_base_files cft addition Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Kamalesh Babulal @ 2023-09-12  7:04 UTC (permalink / raw)
  To: Tejun Heo, Zefan Li, Johannes Weiner; +Cc: Tom Hromatka, cgroups, linux-kernel

There is no check for possible failure while populating
cgroup1_base_files cft in css_populate_dir(), like its cgroup v2 counter
parts cgroup_{base,psi}_files.  In case of failure, the cgroup might not
be set up right.  Add ret value check to return on failure.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
---
 kernel/cgroup/cgroup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 1fb7f562289d..a6b1ea324b0e 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1731,8 +1731,10 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
 					return ret;
 			}
 		} else {
-			cgroup_addrm_files(css, cgrp,
-					   cgroup1_base_files, true);
+			ret  =  cgroup_addrm_files(css, cgrp,
+						   cgroup1_base_files, true);
+			if  (ret  < 0)
+				return ret;
 		}
 	} else {
 		list_for_each_entry(cfts, &css->ss->cfts, node) {

base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
2.41.0


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

end of thread, other threads:[~2023-09-18 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12  7:04 [PATCH 1/2] cgroup: Check for ret during cgroup1_base_files cft addition Kamalesh Babulal
2023-09-12  7:04 ` [PATCH 2/2] cgroup: Avoid extra dereference in css_populate_dir() Kamalesh Babulal
2023-09-18 18:58   ` Tejun Heo
2023-09-18 18:57 ` [PATCH 1/2] cgroup: Check for ret during cgroup1_base_files cft addition 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®