FAILED: patch "[PATCH] nvme: sanitize metadata bounce buffer for reads" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 2b32c76e2b0154b98b9322ae7546b8156cd703e6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102145-nacho-gulp-0f93@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2b32c76e2b0154b98b9322ae7546b8156cd703e6 Mon Sep 17 00:00:00 2001
From: Keith Busch <[email protected]>
Date: Mon, 16 Oct 2023 13:12:47 -0700
Subject: [PATCH] nvme: sanitize metadata bounce buffer for reads
User can request more metadata bytes than the device will write. Ensure kernel buffer is initialized so we're not leaking unsanitized memory on the copy-out.
drivers/nvme/host/ioctl.c +7 -3
@@ -108,9 +108,13 @@ static void *nvme_add_user_metadata(struct request *req, void __user *ubuf,if (!buf) goto out; - ret = -EFAULT ; -if ((req_op (req) ==REQ_OP_DRV_OUT ) &©_from_user (buf, ubuf, len)) - goto out_free_meta; +if (req_op (req) ==REQ_OP_DRV_OUT ) { + ret = -EFAULT ; +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)) {