]> git.itanic.dy.fi Git - linux-stable/commit
cgroup: cgroup_get_from_id() must check the looked-up kn is a directory
authorMing Lei <ming.lei@redhat.com>
Fri, 23 Sep 2022 11:51:19 +0000 (19:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:32:22 +0000 (11:32 +0200)
commit1e9571887f97b17cf3ffe9aa4da89090ea60988b
treea0c4761eec89d34f2e49aed3c0909f494c6f7e15
parenta899ba61958e722183f7b1cf58466f63e17eb54f
cgroup: cgroup_get_from_id() must check the looked-up kn is a directory

commit df02452f3df069a59bc9e69c84435bf115cb6e37 upstream.

cgroup has to be one kernfs dir, otherwise kernel panic is caused,
especially cgroup id is provide from userspace.

Reported-by: Marco Patalano <mpatalan@redhat.com>
Fixes: 6b658c4863c1 ("scsi: cgroup: Add cgroup_get_from_id()")
Cc: Muneendra <muneendra.kumar@broadcom.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Mukesh Ojha <quic_mojha@quicinc.com>
Cc: stable@vger.kernel.org # v5.14+
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/cgroup/cgroup.c