Unverified Commit e7d9f8db authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!13186 virtio_pmem: Check device status before requesting flush

parents 12c49fdb 96d20889
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -44,6 +44,15 @@ static int virtio_pmem_flush(struct nd_region *nd_region)
	unsigned long flags;
	int err, err1;

	/*
	 * Don't bother to submit the request to the device if the device is
	 * not activated.
	 */
	if (vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_NEEDS_RESET) {
		dev_info(&vdev->dev, "virtio pmem device needs a reset\n");
		return -EIO;
	}

	might_sleep();
	req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
	if (!req_data)