]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix leaking minors of hidden disks
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Oct 2022 13:18:57 +0000 (15:18 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Oct 2022 14:48:59 +0000 (08:48 -0600)
commit6143c94e317431a0eb0541e00c55d83d3a0cb807
tree9139aab8f603266b98f1c409fcfe9fd4654ee7e0
parente060c451da305ad9d2ab8f5d6a919bd1ffe540a9
block: fix leaking minors of hidden disks

The major/minor of a hidden gendisk is not propagated to the block
device because it is never registered using bdev_add.  But the lack of
bd_dev also causes the dynamic major minor number not to be freed.
Assign bd_dev manually to ensure the dynamic major minor gets freed.

Based on a patch by Keith Busch.

Fixes: 4b1e1b04e618 ("block: introduce GENHD_FL_HIDDEN")
Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20221010131857.748129-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c