FAILED: patch "[PATCH] cgroup: cgroup_get_from_id() must check the looked-up kn is a" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
df02452f3df0 ("cgroup: cgroup_get_from_id() must check the looked-up kn is a directory") be288169712f ("cgroup: reduce dependency on cgroup_mutex")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From df02452f3df069a59bc9e69c84435bf115cb6e37 Mon Sep 17 00:00:00 2001
From: Ming Lei <[email protected]>
Date: Fri, 23 Sep 2022 19:51:19 +0800
Subject: [PATCH] cgroup: cgroup_get_from_id() must check the looked-up kn is a
directory
cgroup has to be one kernfs dir, otherwise kernel panic is caused, especially cgroup id is provide from userspace.
kernel/cgroup/cgroup.c +4 -1
@@ -6049,6 +6049,9 @@ struct cgroup *cgroup_get_from_id(u64 id)if (!kn) goto out; +if (kernfs_type (kn) !=KERNFS_DIR ) + goto put; +rcu_read_lock (); cgrp =rcu_dereference (*(void __rcu __force **)&kn->priv);
@@ -6056,7 +6059,7 @@ struct cgroup *cgroup_get_from_id(u64 id) cgrp =NULL ;rcu_read_unlock (); - +put:kernfs_put (kn); out:return cgrp;