memstick/mspro_block: fix handling of read-only devices
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Feb 2022 09:45:12 +0000 (10:45 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Feb 2022 02:44:24 +0000 (19:44 -0700)
commit6dab421bfe06a59bf8f212a72e34673e8acf2018
tree7ef99f93b46f04c14d73a0e224095133d9b08af6
parente2efa0796607efe60c708271be483c3a2b0128de
memstick/mspro_block: fix handling of read-only devices

Use set_disk_ro to propagate the read-only state to the block layer
instead of checking for it in ->open and leaking a reference in case
of a read-only device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220215094514.3828912-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/memstick/core/mspro_block.c