From nobody Sun Apr 5 18:18:41 2026 Received: from cae.in-ulm.de (cae.in-ulm.de [217.10.14.231]) (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 987F937CD59 for ; Mon, 23 Mar 2026 21:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.14.231 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774301654; cv=none; b=rzlbCYyMgmhvZDvVDD5vfMmmB03p/0gzNg2UgjfXR7pM0A24t77bQ6a53wtPgZ1Hf/2NEQxNPP16/Y5Da6WBI9FTsaD94qXCMTsW9dE27avCfczE3Q80Lzrw6Xn+IUR5FRuPdyaykErpJirGP0ydph4dZuUJBrSXf+ji3eWMv3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774301654; c=relaxed/simple; bh=vLygAxpgoaaK8XqJg4I9fpb4dql/q/NDA7UTgPqD0Yc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=auEkSYkjXk3J/nGPXGoF0Kf6nndWRyLxo4OEIFjgx16TYV56Dfel+Z9ZFThNHyuZzSKr3qQ46HkeJ4CAhnJIJh21/+7Z2A1dLSsq6i1i/vsq/UVsb6sPhUHU5yHvuMJCQqu35hsjBmSP8sTOagEsWHQMr1FIjbiP/kFWqlU3RXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de; spf=pass smtp.mailfrom=c--e.de; arc=none smtp.client-ip=217.10.14.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=c--e.de Received: by cae.in-ulm.de (Postfix, from userid 1000) id 31E6A1400FB; Mon, 23 Mar 2026 22:24:01 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org, Andrew Morton , David Howells Cc: "Christian A. Ehrhardt" , Kees Cook , Petr Mladek , David Gow Subject: [PATCH RESEND 3/3] lib: Fix length calculation in extract_kvec_to_sg Date: Mon, 23 Mar 2026 22:23:50 +0100 Message-Id: <20260323212350.807118-4-lk@c--e.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260323212350.807118-1-lk@c--e.de> References: <20260323212350.807118-1-lk@c--e.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When extracting from a kvec to a scatterlist, do not cross page boundaries. The required length is already calculated but not used as intended. The previous changes to the kunit_iov_iter.c demonstrate that the patch is necessary. Cc: David Howells Cc: Andrew Morton Cc: stable@vger.kernel.org # v6.5+ Fixes: 018584697533 ("netfs: Add a function to extract an iterator into a s= catterlist") Signed-off-by: Christian A. Ehrhardt --- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 21bc9c1f7c06..73893ee0d92d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -1249,7 +1249,7 @@ static ssize_t extract_kvec_to_sg(struct iov_iter *it= er, else page =3D virt_to_page((void *)kaddr); =20 - sg_set_page(sg, page, len, off); + sg_set_page(sg, page, seg, off); sgtable->nents++; sg++; sg_max--; --=20 2.43.0