Skip to content
  • Eryu Guan's avatar
    blk-mq-debugfs: don't allow write on attributes with seq_operations set · 6b136a24
    Eryu Guan authored
    
    
    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: default avatarEryu Guan <eguan@redhat.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    6b136a24