History

Merge tag 'driver-core-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH: "Here are the set of driver core and kernfs changes for 6.8-rc1. Nothing major in here this release cycle, just lots of small cleanups and some tweaks on kernfs that in the very end, got reverted and will come back in a safer way next release cycle. Included in here are: - more driver core 'const' cleanups and fixes - fw_devlink=rpm is now the default behavior - kernfs tiny changes to remove some string functions - cpu handling in the driver core is updated to work better on many systems that add topologies and cpus after booting - other minor changes and cleanups All of the cpu handling patches have been acked by the respective maintainers and are coming in here in one series. Everything has been in linux-next for a while with no reported issues" * tag 'driver-core-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (51 commits) Revert "kernfs: convert kernfs_idr_lock to an irq safe raw spinlock" kernfs: convert kernfs_idr_lock to an irq safe raw spinlock class: fix use-after-free in class_register() PM: clk: make pm_clk_add_notifier() take a const pointer EDAC: constantify the struct bus_type usage kernfs: fix reference to renamed function driver core: device.h: fix Excess kernel-doc description warning driver core: class: fix Excess kernel-doc description warning driver core: mark remaining local bus_type variables as const driver core: container: make container_subsys const driver core: bus: constantify subsys_register() calls driver core: bus: make bus_sort_breadthfirst() take a const pointer kernfs: d_obtain_alias(NULL) will do the right thing... driver core: Better advertise dev_err_probe() kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to strscpy() kernfs: Convert kernfs_name_locked() from strlcpy() to strscpy() kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy() initramfs: Expose retained initrd as sysfs file fs/kernfs/dir: obey S_ISGID kernel/cgroup: use kernfs_create_dir_ns() ...

Linus Torvalds committed 2 years ago

Commit 80955ae2 parents 296455a e3977e051 files · +207 −253Browse files

Showing the changes to kernel (3 of 51 files). Show all

Unified · Split

3 files
  1. kernel/cgroup/cgroup-v1.c +1 −1
  2. kernel/cgroup/cgroup.c +6 −29
  3. kernel/cgroup/cpuset.c +1 −1
kernel/cgroup/cgroup-v1.c+1−1
@@ -802,7 +802,7 @@ void cgroup1_release_agent(struct work_struct *work) · 801 unmodified lines
802802 goto out_free;
803803
804804 ret = cgroup_path_ns(cgrp, pathbuf, PATH_MAX, &init_cgroup_ns);
805− if (ret < 0 || ret >= PATH_MAX)
805+ if (ret < 0)
806806 goto out_free;
807807
808808 argv[0] = agentbuf;
kernel/cgroup/cgroup.c+6−29
@@ -1906,7 +1906,7 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, · 1905 unmodified lines
19061906 len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX);
19071907 spin_unlock_irq(&css_set_lock);
19081908
1909− if (len >= PATH_MAX)
1909+ if (len == -E2BIG)
19101910 len = -ERANGE;
19111911 else if (len > 0) {
19121912 seq_escape(sf, buf, " \t\n\\");
@@ -4182,20 +4182,6 @@ static struct kernfs_ops cgroup_kf_ops = { · 2269 unmodified lines
41824182 .seq_show = cgroup_seqfile_show,
41834183 };
41844184
4185−/* set uid and gid of cgroup dirs and files to that of the creator */
4186−static int cgroup_kn_set_ugid(struct kernfs_node *kn)
4187−{
4188− struct iattr iattr = { .ia_valid = ATTR_UID | ATTR_GID,
4189− .ia_uid = current_fsuid(),
4190− .ia_gid = current_fsgid(), };
4191−
4192− if (uid_eq(iattr.ia_uid, GLOBAL_ROOT_UID) &&
4193− gid_eq(iattr.ia_gid, GLOBAL_ROOT_GID))
4194− return 0;
4195−
4196− return kernfs_setattr(kn, &iattr);
4197−}
4198−
41994185 static void cgroup_file_notify_timer(struct timer_list *timer)
42004186 {
42014187 cgroup_file_notify(container_of(timer, struct cgroup_file,
@@ -4208,25 +4194,18 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, · 6 unmodified lines
42084194 char name[CGROUP_FILE_NAME_MAX];
42094195 struct kernfs_node *kn;
42104196 struct lock_class_key *key = NULL;
4211− int ret;
42124197
42134198 #ifdef CONFIG_DEBUG_LOCK_ALLOC
42144199 key = &cft->lockdep_key;
42154200 #endif
42164201 kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name),
42174202 cgroup_file_mode(cft),
4218− GLOBAL_ROOT_UID, GLOBAL_ROOT_GID,
4203+ current_fsuid(), current_fsgid(),
42194204 0, cft->kf_ops, cft,
42204205 NULL, key);
42214206 if (IS_ERR(kn))
42224207 return PTR_ERR(kn);
42234208
4224− ret = cgroup_kn_set_ugid(kn);
4225− if (ret) {
4226− kernfs_remove(kn);
4227− return ret;
4228− }
4229−
42304209 if (cft->file_offset) {
42314210 struct cgroup_file *cfile = (void *)css + cft->file_offset;
42324211
@@ -5629,7 +5608,9 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name, · 1396 unmodified lines
56295608 goto out_cancel_ref;
56305609
56315610 /* create the directory */
5632− kn = kernfs_create_dir(parent->kn, name, mode, cgrp);
5611+ kn = kernfs_create_dir_ns(parent->kn, name, mode,
5612+ current_fsuid(), current_fsgid(),
5613+ cgrp, NULL);
56335614 if (IS_ERR(kn)) {
56345615 ret = PTR_ERR(kn);
56355616 goto out_stat_exit;
@@ -5774,10 +5755,6 @@ int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode) · 138 unmodified lines
57745755 */
57755756 kernfs_get(cgrp->kn);
57765757
5777− ret = cgroup_kn_set_ugid(cgrp->kn);
5778− if (ret)
5779− goto out_destroy;
5780−
57815758 ret = css_populate_dir(&cgrp->self);
57825759 if (ret)
57835760 goto out_destroy;
@@ -6316,7 +6293,7 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, · 532 unmodified lines
63166293 if (cgroup_on_dfl(cgrp) || !(tsk->flags & PF_EXITING)) {
63176294 retval = cgroup_path_ns_locked(cgrp, buf, PATH_MAX,
63186295 current->nsproxy->cgroup_ns);
6319− if (retval >= PATH_MAX)
6296+ if (retval == -E2BIG)
63206297 retval = -ENAMETOOLONG;
63216298 if (retval < 0)
63226299 goto out_unlock;
kernel/cgroup/cpuset.c+1−1
@@ -5092,7 +5092,7 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, · 5091 unmodified lines
50925092 retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX,
50935093 current->nsproxy->cgroup_ns);
50945094 css_put(css);
5095− if (retval >= PATH_MAX)
5095+ if (retval == -E2BIG)
50965096 retval = -ENAMETOOLONG;
50975097 if (retval < 0)
50985098 goto out_free;