diff options
| author | Shakeel Butt <shakeel.butt@linux.dev> | 2026-09-12 19:14:52 -0700 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-25 16:59:11 +0200 |
| commit | 8b64f32fee95a977b137b0dd5050bc68d93f6f60 (patch) | |
| tree | edefac62480852033f0b4478dbe411296291e75b /tools/lib/python | |
| parent | 4424f06120fda0f63f3d9e9992990d7790d902a4 (diff) | |
| download | linux-next-8b64f32fee95a977b137b0dd5050bc68d93f6f60.tar.gz linux-next-8b64f32fee95a977b137b0dd5050bc68d93f6f60.zip | |
kernfs: allocate the new name outside kernfs_rwsem
kernfs_rename_ns() calls kstrdup_const() while holding the kernfs_rwsem
write lock. It is the only GFP_KERNEL allocation under that lock in
kernfs, so a rename can enter reclaim while every create, remove and
rename in the hierarchy waits behind it.
Copy the name before taking the lock and free the copy again if the
rename turns out not to need it. A rename that keeps the name, hits a
collision or finds the node gone now does one extra kstrdup_const();
renames are rare. -ENOMEM is still reported at the same point as
before, so nothing changes about which error a caller sees.
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://patch.msgid.link/20260913021453.21507-3-shakeel.butt@linux.dev
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
