]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: do not call del_gendisk() on a disk that was never added
authorNiklas Cassel <niklas.cassel@wdc.com>
Sun, 7 Jun 2020 11:45:20 +0000 (13:45 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Jun 2020 15:10:05 +0000 (09:10 -0600)
commit55a0eeb062358a26ba358ca13d54999f21446db7
treecafaf54adfe4a9ba1c8839b171e9a5deae7ba9e4
parent60f351710e67ef3375974c49ac5a4ebbb1844c71
nvme: do not call del_gendisk() on a disk that was never added

device_add_disk() is negated by del_gendisk().
alloc_disk_node() is negated by put_disk().

In nvme_alloc_ns(), device_add_disk() is one of the last things being
called in the success case, and only void functions are being called
after this. Therefore this call should not be negated in the error path.

The superfluous call to del_gendisk() leads to the following prints:
[    7.839975] kobject: '(null)' (000000001ff73734): is not initialized, yet kobject_put() is being called.
[    7.840865] WARNING: CPU: 2 PID: 361 at lib/kobject.c:736 kobject_put+0x70/0x120

Fixes: 2d87d89380e3 ("nvme: enforce extended LBA format for fabrics metadata")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c