]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq-debugfs: don't allow write on attributes with seq_operations set
authorEryu Guan <eguan@redhat.com>
Tue, 23 Jan 2018 17:20:00 +0000 (01:20 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 Jan 2018 16:46:09 +0000 (09:46 -0700)
commitb08f8dfaeede7d58a238412749756ccebf2b5f7b
treeefa76cb522a4a75c2970b6ec0a59aa64ba391706
parent8b9d239d2fb786bd33514d706a401e186a029986
blk-mq-debugfs: don't allow write on attributes with seq_operations set

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.

Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-debugfs.c