diff options
author | Christoph Hellwig <[email protected]> | 2022-07-22 18:38:16 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2022-07-22 09:22:53 -0600 |
commit | fa9482e0b23d9abe7034becff59daeaba09146ff (patch) | |
tree | 4e7689f3499b0d4daf0fc25815854a777de8b66a /fs/btrfs/inode.c | |
parent | e94eb459d3e4604927ab4e08f81649fcea418318 (diff) |
ublk_drv: fix error handling of ublk_add_dev
__ublk_destroy_dev() is called for handling error in ublk_add_dev(),
but either tagset isn't allocated or mutex isn't initialized.
So fix the issue by letting replacing ublk_add_dev with a
ublk_add_tag_set function that is much more limited in scope and
instead unwind every single step directly in ublk_ctrl_add_dev.
To allow for this refactor the device freeing so that there is
a helper for freeing the device number instead of coupling that
with freeing the mutex and the memory.
Note that this now copies the dev_info to userspace before adding
the character device. This not only simplifies the erro handling
in ublk_ctrl_add_dev, but also means that the character device
can only be seen by userspace if the device addition succeeded.
Based on a patch from Ming Lei.
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'fs/btrfs/inode.c')
0 files changed, 0 insertions, 0 deletions