From nobody Sun Apr 5 16:28:28 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 79ED1324B19 for ; Fri, 20 Feb 2026 09:39:17 +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=1771580358; cv=none; b=kpCSxpwBTHsqt4gNIMo7QzQocUz0YO5O/uOQNsgbtHJyXb33/rUWo65+fkT8zDR1NSjHHMvlEyoct3GukuAe1G35OSek+YkIoYlB3L6epmkb79jmPNHnVQqaDpJZeyL+qBBXGfIX5Kq+m6lRQ5m82ZAOMPjRSsnZwSSuYGnyg4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771580358; c=relaxed/simple; bh=vLygAxpgoaaK8XqJg4I9fpb4dql/q/NDA7UTgPqD0Yc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MFlsY1vqXvd2qdsXLEWvfptGZtqnkGCD0355tlSS1UqjLqVa+ocdNnpQlD3nACorOAxeR4Zg0UGWKgYY4QIvsuiTxNb3LNryD5KoUu18kNpIxLrB8qB7I/0bBNQ1P5CQxhPhcWAkga1CjMe5CU4fEWUEYlI86Xlzm1XOzOHegIU= 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 D68FD14011E; Fri, 20 Feb 2026 10:39:15 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org, Andrew Morton Cc: "Christian A. Ehrhardt" , David Howells , Kees Cook , Petr Mladek , David Gow Subject: [PATCH 3/3] lib: Fix length calculation in extract_kvec_to_sg Date: Fri, 20 Feb 2026 10:38:37 +0100 Message-Id: <20260220093837.688841-4-lk@c--e.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260220093837.688841-1-lk@c--e.de> References: <20260220093837.688841-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