summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/python_version.py
diff options
context:
space:
mode:
authorShakeel Butt <shakeel.butt@linux.dev>2026-09-05 12:16:13 -0700
committerChristian Brauner <brauner@kernel.org>2026-09-10 09:36:48 +0200
commit81bdc85b4c086502f4446a58eb5d25f29bb5e9f7 (patch)
treea0d13e3222a6807ac1f575e5c2a900cfc2b3f625 /tools/lib/python/kdoc/python_version.py
parentdc1a0cc95737344b1a6aa42075e573e9625c6b9a (diff)
downloadlinux-next-81bdc85b4c086502f4446a58eb5d25f29bb5e9f7.tar.gz
linux-next-81bdc85b4c086502f4446a58eb5d25f29bb5e9f7.zip
kernfs: fix up the unlocked attribute reads on the creation paths
Two creation paths read a live node's attributes without holding kernfs_iattr_rwsem, which kernfs_iop_setattr() takes for writing. They need different fixes. kernfs_create_link() copies the target's ia_uid and then its ia_gid into the new link. A chown of the target between the two reads leaves the link with the old uid and the new gid, an owner the target never had. Read both under the rwsem. kernfs_new_node() reads the parent's mode and ia_gid for S_ISGID inheritance. Either value is fine there: the node does not exist yet, so nothing orders a racing chmod or chown against the creation. Taking the rwsem would only pick between two answers that are both right. Mark the reads with READ_ONCE() instead. The pointer that leads to them is already fine: __kernfs_iattrs() publishes kernfs_node::iattr with try_cmpxchg(), and both sides read it with READ_ONCE(), like the rest of fs/kernfs. The Fixes tag is for the symlink half. kernfs_create_link() has read the pair unlocked since it started copying the target's owner; only the name of the lock its writer takes has changed. The READ_ONCE() markings are not a fix. Fixes: 488dee96bb62 ("kernfs: allow creating kernfs objects with arbitrary uid/gid") Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev> Link: https://patch.msgid.link/20260905191613.3143937-5-shakeel.butt@linux.dev Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions