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

!3861 nvme: sanitize metadata bounce buffer for reads

parents 45c59d88 045de296
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -966,9 +966,13 @@ static void *nvme_add_user_metadata(struct bio *bio, void __user *ubuf,
	if (!buf)
		goto out;

	if (write) {
		ret = -EFAULT;
	if (write && copy_from_user(buf, ubuf, len))
		if (copy_from_user(buf, ubuf, len))
			goto out_free_meta;
	} else {
		memset(buf, 0, len);
	}

	bip = bio_integrity_alloc(bio, GFP_KERNEL, 1);
	if (IS_ERR(bip)) {