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 9890437DE8C 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=OLQSkijMx1/xtWd7FhFPaouNo5+PnnUSzxBWWs7cz2ci+6ZdZye72N5o/WbiE3e5CSLSh172gQ5KcAzofRN4nkYzpyVlgqIPIUjrhXoCUy1bWpdWBPJIYISZ67kgX+aWUL5QFfDqMt3r1zY8LCH2CzIWnMndHV4n/v+Ljks/fvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774301654; c=relaxed/simple; bh=ljWil7dA/TW2W2PcEgH5qokNfA3SUAvqU4XR6NrG7Qc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ld+cgLwgDv3+k4wRCS/42thl7kX5N7tK+vvE+smfvRqq9IdKm/xxfaXv/4WApoBuYzZf6Xbnly4h+NtbcdeRxhRglFY/S9BqaWmvvY0/FKxRzV+XO/Ba0iGqoIodeoqIId8+wt5l/B/8mAI1oSZOfYNGfBPiRJTGHJ1H5Jof5sA= 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 E8960140041; Mon, 23 Mar 2026 22:24:00 +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 0/3] Fix length calculation bug in extract_kvec_to_sg Date: Mon, 23 Mar 2026 22:23:47 +0100 Message-Id: <20260323212350.807118-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