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() ...
Showing the changes to kernel (3 of 51 files). Show all
Unified · Split
| @@ -802,7 +802,7 @@ void cgroup1_release_agent(struct work_struct *work) · 801 unmodified lines | ||
| 802 | 802 | goto out_free; |
| 803 | 803 | |
| 804 | 804 | ret = cgroup_path_ns(cgrp, pathbuf, PATH_MAX, &init_cgroup_ns); |
| 805 | − if (ret < 0 || ret >= PATH_MAX) | |
| 805 | + if (ret < 0) | |
| 806 | 806 | goto out_free; |
| 807 | 807 | |
| 808 | 808 | argv[0] = agentbuf; |
| @@ -1906,7 +1906,7 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, · 1905 unmodified lines | ||
| 1906 | 1906 | len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX); |
| 1907 | 1907 | spin_unlock_irq(&css_set_lock); |
| 1908 | 1908 | |
| 1909 | − if (len >= PATH_MAX) | |
| 1909 | + if (len == -E2BIG) | |
| 1910 | 1910 | len = -ERANGE; |
| 1911 | 1911 | else if (len > 0) { |
| 1912 | 1912 | seq_escape(sf, buf, " \t\n\\"); |
| @@ -4182,20 +4182,6 @@ static struct kernfs_ops cgroup_kf_ops = { · 2269 unmodified lines | ||
| 4182 | 4182 | .seq_show = cgroup_seqfile_show, |
| 4183 | 4183 | }; |
| 4184 | 4184 | |
| 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 | − | |
| 4199 | 4185 | static void cgroup_file_notify_timer(struct timer_list *timer) |
| 4200 | 4186 | { |
| 4201 | 4187 | 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 | ||
| 4208 | 4194 | char name[CGROUP_FILE_NAME_MAX]; |
| 4209 | 4195 | struct kernfs_node *kn; |
| 4210 | 4196 | struct lock_class_key *key = NULL; |
| 4211 | − int ret; | |
| 4212 | 4197 | |
| 4213 | 4198 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 4214 | 4199 | key = &cft->lockdep_key; |
| 4215 | 4200 | #endif |
| 4216 | 4201 | kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), |
| 4217 | 4202 | cgroup_file_mode(cft), |
| 4218 | − GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, | |
| 4203 | + current_fsuid(), current_fsgid(), | |
| 4219 | 4204 | 0, cft->kf_ops, cft, |
| 4220 | 4205 | NULL, key); |
| 4221 | 4206 | if (IS_ERR(kn)) |
| 4222 | 4207 | return PTR_ERR(kn); |
| 4223 | 4208 | |
| 4224 | − ret = cgroup_kn_set_ugid(kn); | |
| 4225 | − if (ret) { | |
| 4226 | − kernfs_remove(kn); | |
| 4227 | − return ret; | |
| 4228 | − } | |
| 4229 | − | |
| 4230 | 4209 | if (cft->file_offset) { |
| 4231 | 4210 | struct cgroup_file *cfile = (void *)css + cft->file_offset; |
| 4232 | 4211 | |
| @@ -5629,7 +5608,9 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name, · 1396 unmodified lines | ||
| 5629 | 5608 | goto out_cancel_ref; |
| 5630 | 5609 | |
| 5631 | 5610 | /* 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); | |
| 5633 | 5614 | if (IS_ERR(kn)) { |
| 5634 | 5615 | ret = PTR_ERR(kn); |
| 5635 | 5616 | 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 | ||
| 5774 | 5755 | */ |
| 5775 | 5756 | kernfs_get(cgrp->kn); |
| 5776 | 5757 | |
| 5777 | − ret = cgroup_kn_set_ugid(cgrp->kn); | |
| 5778 | − if (ret) | |
| 5779 | − goto out_destroy; | |
| 5780 | − | |
| 5781 | 5758 | ret = css_populate_dir(&cgrp->self); |
| 5782 | 5759 | if (ret) |
| 5783 | 5760 | goto out_destroy; |
| @@ -6316,7 +6293,7 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, · 532 unmodified lines | ||
| 6316 | 6293 | if (cgroup_on_dfl(cgrp) || !(tsk->flags & PF_EXITING)) { |
| 6317 | 6294 | retval = cgroup_path_ns_locked(cgrp, buf, PATH_MAX, |
| 6318 | 6295 | current->nsproxy->cgroup_ns); |
| 6319 | − if (retval >= PATH_MAX) | |
| 6296 | + if (retval == -E2BIG) | |
| 6320 | 6297 | retval = -ENAMETOOLONG; |
| 6321 | 6298 | if (retval < 0) |
| 6322 | 6299 | goto out_unlock; |
| @@ -5092,7 +5092,7 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, · 5091 unmodified lines | ||
| 5092 | 5092 | retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX, |
| 5093 | 5093 | current->nsproxy->cgroup_ns); |
| 5094 | 5094 | css_put(css); |
| 5095 | − if (retval >= PATH_MAX) | |
| 5095 | + if (retval == -E2BIG) | |
| 5096 | 5096 | retval = -ENAMETOOLONG; |
| 5097 | 5097 | if (retval < 0) |
| 5098 | 5098 | goto out_free; |