]> www.infradead.org Git - users/hch/misc.git/commit
block: fail to show/store elevator sysfs attribute if elevator is dying
authorMing Lei <ming.lei@redhat.com>
Mon, 5 May 2025 14:17:57 +0000 (22:17 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 6 May 2025 13:43:43 +0000 (07:43 -0600)
commit5c3d858cdc57196e6d438e5ad47a732216e81a9c
tree64de3b466f9096140759c1ff8f43b0fae422d595
parente25ee50dfab9fce77d2e0d89d2413b6c68015f97
block: fail to show/store elevator sysfs attribute if elevator is dying

Prepare for moving elv_register[unregister]_queue out of elevator_lock
& queue freezing, so we may have to call elv_unregister_queue() after
elevator ->exit() is called, then there is small window for user to
call into ->show()/store(), and user-after-free can be caused.

Fail to show/store elevator sysfs attribute if elevator is dying by
adding one new flag of ELEVATOR_FLAG_DYNG, which is protected by
elevator ->sysfs_lock.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20250505141805.2751237-20-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sched.c
block/elevator.c
block/elevator.h