提交 a30b0473 编写于 作者: M Mike Christie 提交者: Martin K. Petersen

scsi: tcmu: check if dev is configured before block/reset

Do not allow userspace to block or reset the ring until the device has been
configured. This will prevent the bug where userspace can write to those
files and access mb_addr before it has been setup.
Signed-off-by: NMike Christie <mchristi@redhat.com>
Reviewed-by: NXiubo Li <xiubli@redhat.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 63d5be0f
......@@ -2480,6 +2480,11 @@ static ssize_t tcmu_block_dev_store(struct config_item *item, const char *page,
u8 val;
int ret;
if (!target_dev_configured(&udev->se_dev)) {
pr_err("Device is not configured.\n");
return -EINVAL;
}
ret = kstrtou8(page, 0, &val);
if (ret < 0)
return ret;
......@@ -2507,6 +2512,11 @@ static ssize_t tcmu_reset_ring_store(struct config_item *item, const char *page,
u8 val;
int ret;
if (!target_dev_configured(&udev->se_dev)) {
pr_err("Device is not configured.\n");
return -EINVAL;
}
ret = kstrtou8(page, 0, &val);
if (ret < 0)
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册