Skip to content

userns: clean up dead code on error paths

Tao Cui lkml 1 version Applied

Status from this message: Applied to the vfs-7.4.namespace branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2userns: remove dead key_put() on the create_user_ns() error pathkernel/user_namespace.c+0 -32 replies
2/2userns: don't clear the install target map on map_write() failurekernel/user_namespace.c+0 -34 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchJan KaraBradley Morgan
1/2R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] userns: clean up dead code on error paths

From: Tao Cui <[email protected]>

Two small cleanups on the create_user_ns() and map_write() error paths. Both remove code that provably cannot have an effect; no behavior change.

user_namespace.c:164-167: the key_put() at fail_keyring has been dead since it was copy-pasted from free_user_ns() in 2016 (dbec28460a89); persistent_keyring_register is only ever assigned lazily from key_get_persistent(), long after create_user_ns().

user_namespace.c:1110-1112: the map clearing at the out: label of map_write() only ever zeroes an already-zero map; the destination map is untouched on every error path, and a second write to a mapped namespace is rejected before parsing.

Compile-tested and A/B-tested on next-20260827: identical behavior on vanilla and patched kernels for single-write map failures, recovery writes and 300 rounds of userns create/destroy.

Tao Cui (2):
userns: remove dead key_put() on the create_user_ns() error path
userns: don't clear the install target map on map_write() failure

 kernel/user_namespace.c | 6 ------
 1 file changed, 6 deletions(-)
Signature · 1 line
2.43.0