]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ublk: fix ublksrv pid handling for pid namespaces
authorSeamus Connor <sconnor@purestorage.com>
Thu, 15 Jan 2026 02:59:52 +0000 (18:59 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 21 Jan 2026 14:46:14 +0000 (07:46 -0700)
commit47bdf1d29caec7207b7f112230055db36602dfc0
tree7670b226bdfbd20d5954729bc6c3c3ae9c3236b4
parent07a1bc5c14c9ef6401b21c1873c6c087075ff292
ublk: fix ublksrv pid handling for pid namespaces

When ublksrv runs inside a pid namespace, START/END_RECOVERY compared
the stored init-ns tgid against the userspace pid (getpid vnr), so the
check failed and control ops could not proceed. Compare against the
caller’s init-ns tgid and store that value, then translate it back to
the caller’s pid namespace when reporting GET_DEV_INFO so ublk list
shows a sensible pid.

Testing: start/recover in a pid namespace; `ublk list` shows
reasonable pid values in init, child, and sibling namespaces.

Fixes: c2c8089f325e ("ublk: validate ublk server pid")
Signed-off-by: Seamus Connor <sconnor@purestorage.com>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c