+++ /dev/null
-From 9d8503d8acddd2f9ecb8fa58ac2b1c2a0d49b791 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Aug 2022 18:52:35 +0200
-Subject: cgroup: Honor caller's cgroup NS when resolving path
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Michal Koutný <mkoutny@suse.com>
-
-[ Upstream commit 74e4b956eb1cac0e4c10c240339b1bbfbc9a4c48 ]
-
-cgroup_get_from_path() is not widely used function. Its callers presume
-the path is resolved under cgroup namespace. (There is one caller
-currently and resolving in init NS won't make harm (netfilter). However,
-future users may be subject to different effects when resolving
-globally.)
-Since, there's currently no use for the global resolution, modify the
-existing function to take cgroup NS into account.
-
-Fixes: a79a908fd2b0 ("cgroup: introduce cgroup namespaces")
-Signed-off-by: Michal Koutný <mkoutny@suse.com>
-Signed-off-by: Tejun Heo <tj@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/cgroup/cgroup.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
-index f0da7cfe5a34..312a63f328ec 100644
---- a/kernel/cgroup/cgroup.c
-+++ b/kernel/cgroup/cgroup.c
-@@ -6476,8 +6476,12 @@ struct cgroup *cgroup_get_from_path(const char *path)
- {
- struct kernfs_node *kn;
- struct cgroup *cgrp = ERR_PTR(-ENOENT);
-+ struct cgroup *root_cgrp;
-
-- kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path);
-+ spin_lock_irq(&css_set_lock);
-+ root_cgrp = current_cgns_cgroup_from_root(&cgrp_dfl_root);
-+ kn = kernfs_walk_and_get(root_cgrp->kn, path);
-+ spin_unlock_irq(&css_set_lock);
- if (!kn)
- goto out;
-
---
-2.35.1
-
+++ /dev/null
-From 5bb3078936faa526a813cb7a10de42467cb6bc43 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 24 Oct 2021 23:19:14 -0700
-Subject: cgroup: reduce dependency on cgroup_mutex
-
-From: Shakeel Butt <shakeelb@google.com>
-
-[ Upstream commit be288169712f3dea0bc6b50c00b3ab53d85f1435 ]
-
-Currently cgroup_get_from_path() and cgroup_get_from_id() grab
-cgroup_mutex before traversing the default hierarchy to find the
-kernfs_node corresponding to the path/id and then extract the linked
-cgroup. Since cgroup_mutex is still held, it is guaranteed that the
-cgroup will be alive and the reference can be taken on it.
-
-However similar guarantee can be provided without depending on the
-cgroup_mutex and potentially reducing avenues of cgroup_mutex contentions.
-The kernfs_node's priv pointer is RCU protected pointer and with just
-rcu read lock we can grab the reference on the cgroup without
-cgroup_mutex. So, remove cgroup_mutex from them.
-
-Signed-off-by: Shakeel Butt <shakeelb@google.com>
-Signed-off-by: Tejun Heo <tj@kernel.org>
-Stable-dep-of: 74e4b956eb1c ("cgroup: Honor caller's cgroup NS when resolving path")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/cgroup/cgroup.c | 51 ++++++++++++++++++++++++------------------
- 1 file changed, 29 insertions(+), 22 deletions(-)
-
-diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
-index c420b048466b..f0da7cfe5a34 100644
---- a/kernel/cgroup/cgroup.c
-+++ b/kernel/cgroup/cgroup.c
-@@ -5932,17 +5932,20 @@ struct cgroup *cgroup_get_from_id(u64 id)
- struct kernfs_node *kn;
- struct cgroup *cgrp = NULL;
-
-- mutex_lock(&cgroup_mutex);
- kn = kernfs_find_and_get_node_by_id(cgrp_dfl_root.kf_root, id);
- if (!kn)
-- goto out_unlock;
-+ goto out;
-+
-+ rcu_read_lock();
-
-- cgrp = kn->priv;
-- if (cgroup_is_dead(cgrp) || !cgroup_tryget(cgrp))
-+ cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
-+ if (cgrp && !cgroup_tryget(cgrp))
- cgrp = NULL;
-+
-+ rcu_read_unlock();
-+
- kernfs_put(kn);
--out_unlock:
-- mutex_unlock(&cgroup_mutex);
-+out:
- return cgrp;
- }
- EXPORT_SYMBOL_GPL(cgroup_get_from_id);
-@@ -6466,30 +6469,34 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss)
- *
- * Find the cgroup at @path on the default hierarchy, increment its
- * reference count and return it. Returns pointer to the found cgroup on
-- * success, ERR_PTR(-ENOENT) if @path doesn't exist and ERR_PTR(-ENOTDIR)
-- * if @path points to a non-directory.
-+ * success, ERR_PTR(-ENOENT) if @path doesn't exist or if the cgroup has already
-+ * been released and ERR_PTR(-ENOTDIR) if @path points to a non-directory.
- */
- struct cgroup *cgroup_get_from_path(const char *path)
- {
- struct kernfs_node *kn;
-- struct cgroup *cgrp;
--
-- mutex_lock(&cgroup_mutex);
-+ struct cgroup *cgrp = ERR_PTR(-ENOENT);
-
- kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path);
-- if (kn) {
-- if (kernfs_type(kn) == KERNFS_DIR) {
-- cgrp = kn->priv;
-- cgroup_get_live(cgrp);
-- } else {
-- cgrp = ERR_PTR(-ENOTDIR);
-- }
-- kernfs_put(kn);
-- } else {
-- cgrp = ERR_PTR(-ENOENT);
-+ if (!kn)
-+ goto out;
-+
-+ if (kernfs_type(kn) != KERNFS_DIR) {
-+ cgrp = ERR_PTR(-ENOTDIR);
-+ goto out_kernfs;
- }
-
-- mutex_unlock(&cgroup_mutex);
-+ rcu_read_lock();
-+
-+ cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
-+ if (!cgrp || !cgroup_tryget(cgrp))
-+ cgrp = ERR_PTR(-ENOENT);
-+
-+ rcu_read_unlock();
-+
-+out_kernfs:
-+ kernfs_put(kn);
-+out:
- return cgrp;
- }
- EXPORT_SYMBOL_GPL(cgroup_get_from_path);
---
-2.35.1
-
+++ /dev/null
-From 1fad3a55dc0f84eb8ffe7ba543f23c27d118410e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 9 Nov 2020 16:01:11 +0530
-Subject: kernel: cgroup: Mundane spelling fixes throughout the file
-
-From: Bhaskar Chowdhury <unixbhaskar@gmail.com>
-
-[ Upstream commit 58315c96651152b9f438e5e56c910994234e2c7a ]
-
-Few spelling fixes throughout the file.
-
-Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
-Signed-off-by: Tejun Heo <tj@kernel.org>
-Stable-dep-of: 74e4b956eb1c ("cgroup: Honor caller's cgroup NS when resolving path")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/cgroup/cgroup.c | 22 +++++++++++-----------
- 1 file changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
-index 684c16849eff..0eb05cbafa71 100644
---- a/kernel/cgroup/cgroup.c
-+++ b/kernel/cgroup/cgroup.c
-@@ -244,7 +244,7 @@ bool cgroup_ssid_enabled(int ssid)
- *
- * The default hierarchy is the v2 interface of cgroup and this function
- * can be used to test whether a cgroup is on the default hierarchy for
-- * cases where a subsystem should behave differnetly depending on the
-+ * cases where a subsystem should behave differently depending on the
- * interface version.
- *
- * List of changed behaviors:
-@@ -262,7 +262,7 @@ bool cgroup_ssid_enabled(int ssid)
- * "cgroup.procs" instead.
- *
- * - "cgroup.procs" is not sorted. pids will be unique unless they got
-- * recycled inbetween reads.
-+ * recycled in-between reads.
- *
- * - "release_agent" and "notify_on_release" are removed. Replacement
- * notification mechanism will be implemented.
-@@ -345,7 +345,7 @@ static bool cgroup_is_mixable(struct cgroup *cgrp)
- return !cgroup_parent(cgrp);
- }
-
--/* can @cgrp become a thread root? should always be true for a thread root */
-+/* can @cgrp become a thread root? Should always be true for a thread root */
- static bool cgroup_can_be_thread_root(struct cgroup *cgrp)
- {
- /* mixables don't care */
-@@ -530,7 +530,7 @@ static struct cgroup_subsys_state *cgroup_e_css_by_mask(struct cgroup *cgrp,
- * the root css is returned, so this function always returns a valid css.
- *
- * The returned css is not guaranteed to be online, and therefore it is the
-- * callers responsiblity to tryget a reference for it.
-+ * callers responsibility to try get a reference for it.
- */
- struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
- struct cgroup_subsys *ss)
-@@ -702,7 +702,7 @@ EXPORT_SYMBOL_GPL(of_css);
- ; \
- else
-
--/* walk live descendants in preorder */
-+/* walk live descendants in pre order */
- #define cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) \
- css_for_each_descendant_pre((d_css), cgroup_css((cgrp), NULL)) \
- if (({ lockdep_assert_held(&cgroup_mutex); \
-@@ -937,7 +937,7 @@ void put_css_set_locked(struct css_set *cset)
-
- WARN_ON_ONCE(!list_empty(&cset->threaded_csets));
-
-- /* This css_set is dead. unlink it and release cgroup and css refs */
-+ /* This css_set is dead. Unlink it and release cgroup and css refs */
- for_each_subsys(ss, ssid) {
- list_del(&cset->e_cset_node[ssid]);
- css_put(cset->subsys[ssid]);
-@@ -1062,7 +1062,7 @@ static struct css_set *find_existing_css_set(struct css_set *old_cset,
-
- /*
- * Build the set of subsystem state objects that we want to see in the
-- * new css_set. while subsystems can change globally, the entries here
-+ * new css_set. While subsystems can change globally, the entries here
- * won't change, so no need for locking.
- */
- for_each_subsys(ss, i) {
-@@ -1152,7 +1152,7 @@ static void link_css_set(struct list_head *tmp_links, struct css_set *cset,
-
- /*
- * Always add links to the tail of the lists so that the lists are
-- * in choronological order.
-+ * in chronological order.
- */
- list_move_tail(&link->cset_link, &cgrp->cset_links);
- list_add_tail(&link->cgrp_link, &cset->cgrp_links);
-@@ -4242,7 +4242,7 @@ struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
- * implies that if we observe !CSS_RELEASED on @pos in this RCU
- * critical section, the one pointed to by its next pointer is
- * guaranteed to not have finished its RCU grace period even if we
-- * have dropped rcu_read_lock() inbetween iterations.
-+ * have dropped rcu_read_lock() in-between iterations.
- *
- * If @pos has CSS_RELEASED set, its next pointer can't be
- * dereferenced; however, as each css is given a monotonically
-@@ -4490,7 +4490,7 @@ static struct css_set *css_task_iter_next_css_set(struct css_task_iter *it)
- }
-
- /**
-- * css_task_iter_advance_css_set - advance a task itererator to the next css_set
-+ * css_task_iter_advance_css_set - advance a task iterator to the next css_set
- * @it: the iterator to advance
- *
- * Advance @it to the next css_set to walk.
-@@ -6440,7 +6440,7 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss)
- *
- * Find the cgroup at @path on the default hierarchy, increment its
- * reference count and return it. Returns pointer to the found cgroup on
-- * success, ERR_PTR(-ENOENT) if @path doens't exist and ERR_PTR(-ENOTDIR)
-+ * success, ERR_PTR(-ENOENT) if @path doesn't exist and ERR_PTR(-ENOTDIR)
- * if @path points to a non-directory.
- */
- struct cgroup *cgroup_get_from_path(const char *path)
---
-2.35.1
-
+++ /dev/null
-From 382b7cee9ee1b4dce0d393c1d94a2bfdc0aff047 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 8 Jun 2021 10:05:44 +0530
-Subject: scsi: cgroup: Add cgroup_get_from_id()
-
-From: Muneendra Kumar <muneendra.kumar@broadcom.com>
-
-[ Upstream commit 6b658c4863c15936872a93c9ee879043bf6393c9 ]
-
-Add a new function, cgroup_get_from_id(), to retrieve the cgroup associated
-with a cgroup id. Also export the function cgroup_get_e_css() as this is
-needed in blk-cgroup.h.
-
-Link: https://lore.kernel.org/r/20210608043556.274139-2-muneendra.kumar@broadcom.com
-Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
-Reviewed-by: Hannes Reinecke <hare@suse.de>
-Acked-by: Tejun Heo <tj@kernel.org>
-Signed-off-by: Muneendra Kumar <muneendra.kumar@broadcom.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 74e4b956eb1c ("cgroup: Honor caller's cgroup NS when resolving path")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/cgroup.h | 6 ++++++
- kernel/cgroup/cgroup.c | 26 ++++++++++++++++++++++++++
- 2 files changed, 32 insertions(+)
-
-diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
-index 618838c48313..23375d4ccfa0 100644
---- a/include/linux/cgroup.h
-+++ b/include/linux/cgroup.h
-@@ -696,6 +696,7 @@ static inline void cgroup_kthread_ready(void)
- }
-
- void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen);
-+struct cgroup *cgroup_get_from_id(u64 id);
- #else /* !CONFIG_CGROUPS */
-
- struct cgroup_subsys_state;
-@@ -743,6 +744,11 @@ static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
-
- static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
- {}
-+
-+static inline struct cgroup *cgroup_get_from_id(u64 id)
-+{
-+ return NULL;
-+}
- #endif /* !CONFIG_CGROUPS */
-
- #ifdef CONFIG_CGROUPS
-diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
-index 0eb05cbafa71..c420b048466b 100644
---- a/kernel/cgroup/cgroup.c
-+++ b/kernel/cgroup/cgroup.c
-@@ -580,6 +580,7 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp,
- rcu_read_unlock();
- return css;
- }
-+EXPORT_SYMBOL_GPL(cgroup_get_e_css);
-
- static void cgroup_get_live(struct cgroup *cgrp)
- {
-@@ -5921,6 +5922,31 @@ void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
- kernfs_put(kn);
- }
-
-+/*
-+ * cgroup_get_from_id : get the cgroup associated with cgroup id
-+ * @id: cgroup id
-+ * On success return the cgrp, on failure return NULL
-+ */
-+struct cgroup *cgroup_get_from_id(u64 id)
-+{
-+ struct kernfs_node *kn;
-+ struct cgroup *cgrp = NULL;
-+
-+ mutex_lock(&cgroup_mutex);
-+ kn = kernfs_find_and_get_node_by_id(cgrp_dfl_root.kf_root, id);
-+ if (!kn)
-+ goto out_unlock;
-+
-+ cgrp = kn->priv;
-+ if (cgroup_is_dead(cgrp) || !cgroup_tryget(cgrp))
-+ cgrp = NULL;
-+ kernfs_put(kn);
-+out_unlock:
-+ mutex_unlock(&cgroup_mutex);
-+ return cgrp;
-+}
-+EXPORT_SYMBOL_GPL(cgroup_get_from_id);
-+
- /*
- * proc_cgroup_show()
- * - Print task's cgroup paths into seq_file, one line for each hierarchy
---
-2.35.1
-
powerpc-fix-spe-power-isa-properties-for-e500v1-plat.patch
crypto-sahara-don-t-sleep-when-in-softirq.patch
crypto-hisilicon-zip-fix-mismatch-in-get-set-sgl_sge.patch
-kernel-cgroup-mundane-spelling-fixes-throughout-the-.patch
-scsi-cgroup-add-cgroup_get_from_id.patch
-cgroup-reduce-dependency-on-cgroup_mutex.patch
-cgroup-honor-caller-s-cgroup-ns-when-resolving-path.patch
hwrng-imx-rngc-moving-irq-handler-registering-after-.patch
cgroup-cpuset-enable-update_tasks_cpumask-on-top_cpu.patch
iommu-omap-fix-buffer-overflow-in-debugfs.patch