X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block%2Fblk-mq-debugfs.c;h=54bd8c31b822d25e35c8807903bef9dffbf1277b;hb=63e90e95753a39c1dc7caba4f2fd88af3481a831;hp=b56a4f35720d8a46e8a5daf3f2c63a51475308a3;hpb=580e3d552ddf06537c7f36d1bfab04761489db9c;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);