block: fix error unwinding in blk_register_queue
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Nov 2022 04:26:35 +0000 (05:26 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Nov 2022 18:09:00 +0000 (11:09 -0700)
commit40602997be26887bdfa3d58659c3acb4579099e9
tree4b65cfc7b239f56480cc4075787528b5ed3e25d4
parent6fc75f309d291d328b4ea2f91bef0ff56e4bc7c2
block: fix error unwinding in blk_register_queue

blk_register_queue fails to handle errors from blk_mq_sysfs_register,
leaks various resources on errors and accidentally sets queue refs percpu
refcount to percpu mode on kobject_add failure.  Fix all that by
properly unwinding on errors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221114042637.1009333-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c