X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block%2Fblk-mq-debugfs.c;h=54bd8c31b822d25e35c8807903bef9dffbf1277b;hb=6c9de34aa42c9f82cfa9d0836b8434b6b10cbca1;hp=b56a4f35720d8a46e8a5daf3f2c63a51475308a3;hpb=c353bfc6ebc1073f2f0af72a15f8f18db7193d2e;p=mirror_ubuntu-bionic-kernel.git diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index b56a4f35720d..54bd8c31b822 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -703,7 +703,11 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf, const struct blk_mq_debugfs_attr *attr = m->private; void *data = d_inode(file->f_path.dentry->d_parent)->i_private; - if (!attr->write) + /* + * Attributes that only implement .seq_ops are read-only and 'attr' is + * the same with 'data' in this case. + */ + if (attr == data || !attr->write) return -EPERM; return attr->write(data, buf, count, ppos);