From mboxrd@z Thu Jan 1 00:00:00 1970 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 1C45231E0FA for ; Fri, 20 Feb 2026 09:39:00 +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=1771580344; cv=none; b=Y974m3uuYetFlLVFoUcdwGzaogxJZ1tNkqDFDYwc0AaV6wPuizdkcdnj94zDbr9mPCJbNQuUvQ0wxokIRcT43o2uRsKw5g4+mR2YuwsytGHJmR4CObLsYVxk0X1xnNu3VI+W4CFNb1VOiBgAZXRoc92zh4hVCGeztdQL5G4vM9w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771580344; c=relaxed/simple; bh=ljWil7dA/TW2W2PcEgH5qokNfA3SUAvqU4XR6NrG7Qc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=riob0Xu4Yy/Iv3q4SIRziAo9QGnIJhwFXg2Hk95xnD3XrufwGrbUZM902fYViMIAA3vWwSquyFwpPhOhgJ4CUeh3D0U2eerVof7ILLZ7R3GTXNNa6nvZeyg9uDvrJO8jy67roFjaNeI5dOfBZFQMGnIfZMv9fjijM8T4Ry/delA= 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 C943B140028; Fri, 20 Feb 2026 10:38:58 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org, Andrew Morton Cc: "Christian A. Ehrhardt" , Kees Cook , Petr Mladek , David Gow Subject: [PATCH 0/3] Fix length calculation bug in extract_kvec_to_sg Date: Fri, 20 Feb 2026 10:38:34 +0100 Message-Id: <20260220093837.688841-1-lk@c--e.de> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is a bug in extract_kvec_to_sg() where the length of a scatterlist segment is miscalculated. The actual fix is a one-liner and it is quite obvious from reading the code that this is what was intened. As this is a core library function this series first adds test cases to the kunit_iov_iter test that demonstrate that there is a bug before actually fixing it in the last commit. The bug was orignally introduced into kernel v6.3 where the function lived in fs/netfs/iterator.c. It was later moved to lib/scatterlist.c in v6.5. Thus the actual fix is only marked for backports to v6.5+. Christian A. Ehrhardt (3): lib: kunit_iov_iter: Improve error detection lib: kunit_iov_iter: Add tests for extract_iter_to_sg lib: Fix length calculation in extract_kvec_to_sg lib/scatterlist.c | 2 +- lib/tests/kunit_iov_iter.c | 147 ++++++++++++++++++++++++++++++++++++- 2 files changed, 147 insertions(+), 2 deletions(-) -- 2.43.0