Re: [PATCH] blk-mq-debugfs: don't allow write on attributes with seq_operations set
From: Jens Axboe <axboe@kernel.dk>
Date: 2018-01-23 21:32:06
From: Jens Axboe <axboe@kernel.dk>
Date: 2018-01-23 21:32:06
On 1/23/18 10:20 AM, Eryu Guan wrote:
Attributes that only implement .seq_ops are read-only, any write to them should be rejected. But currently kernel would crash when writing to such debugfs entries, e.g. chmod +w /sys/kernel/debug/block/<dev>/requeue_list echo 0 > /sys/kernel/debug/block/<dev>/requeue_list chmod -w /sys/kernel/debug/block/<dev>/requeue_list Fix it by returning -EPERM in blk_mq_debugfs_write() when writing to such attributes.
I don't particularly like the fix, since it's not really clear why that comparison makes sense. Can't we just prevent anyone from making the debugfs entries writable? Seems like a much more sane approach. -- Jens Axboe