From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C611D537F9; Thu, 30 Nov 2023 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="d0EOOB90" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8742C433C8; Thu, 30 Nov 2023 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1701362057; bh=MGqp95DN9sXbKdLX+f269RMcujg3IFPQAvNahrigEKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d0EOOB90KpXrhTN4ADx8LAjINbhyw49A+SYgxPNJ7wLj3pwnfau9f+rGr3EyMpafR eTury9cGuhTcreJjRWRV0Wv7JpBQL997nX2XTKfKLNRGY5BC6Tab+i12Gu76wYMTAU Jp7/5ThN1cUD3MO+lLzK8EGAiBptvA6ZLllak4qM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Keith Busch , Jens Axboe Subject: [PATCH 5.15 69/69] io_uring: fix off-by one bvec index Date: Thu, 30 Nov 2023 16:23:06 +0000 Message-ID: <20231130162135.340699709@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130162133.035359406@linuxfoundation.org> References: <20231130162133.035359406@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Keith Busch commit d6fef34ee4d102be448146f24caf96d7b4a05401 upstream. If the offset equals the bv_len of the first registered bvec, then the request does not include any of that first bvec. Skip it so that drivers don't have to deal with a zero length bvec, which was observed to break NVMe's PRP list creation. Cc: stable@vger.kernel.org Fixes: bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed buffers") Signed-off-by: Keith Busch Link: https://lore.kernel.org/r/20231120221831.2646460-1-kbusch@meta.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3152,7 +3152,7 @@ static int __io_import_fixed(struct io_k */ const struct bio_vec *bvec = imu->bvec; - if (offset <= bvec->bv_len) { + if (offset < bvec->bv_len) { iov_iter_advance(iter, offset); } else { unsigned long seg_skip;