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 C215947A53; Mon, 1 Apr 2024 16:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711988016; cv=none; b=HGGFJv8WBDvZaFTS/TJVMN4HnVyx3yM32VwAHJOOXZRuhHnw1aUylK4UqmZku2ca0xW7WQlWc+NwYYzgkmnjqtCh4+nnVjFeZo0cQspVVwaPNimwKMRfXOUz/2LtnVjaWRKzQEpZvA7DFYclPm/fl7ZkBkxVOnwDGWbjaouoMqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711988016; c=relaxed/simple; bh=fjmKJUpRpj4PM7QpFTPTP+y2SPaf/8Q6qh4TRIkBGLQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ds9Nst91mfWOeee18TADNjxSJIqpD6iFGRvtktw10sJRaSgdKOSDBbP3BUdY2XS7ZA/h9IePb67djQm6/MT2Vfg1us5ZntyIzU1KNiWzCG5tePwSZiJloyjgrQP1Dbn4i1UiSID1OMIt041wkeZs52pTkRYcLKCTI0e3ynVqvA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YOZs02wx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YOZs02wx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33938C433C7; Mon, 1 Apr 2024 16:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711988016; bh=fjmKJUpRpj4PM7QpFTPTP+y2SPaf/8Q6qh4TRIkBGLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOZs02wxSQ+kDrr7IMKhSK1okbeg26PBw470BVRxHfTp8MbJ/imujOs2IOZ70dIvM 3qY8VIVwmh4Mgv4kWHz6UnvqzpmViH6OrHaHqPObhPqZqPxLvfbWkH5+tYMCmY1tiU GooB9mZIk4w98MyohyU13aTNWrn4St4dscqeSVVA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Palmer Dabbelt , Guenter Roeck , Charlie Jenkins , Helge Deller , Sasha Levin Subject: [PATCH 6.7 059/432] parisc: Fix csum_ipv6_magic on 32-bit systems Date: Mon, 1 Apr 2024 17:40:46 +0200 Message-ID: <20240401152554.887895804@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152553.125349965@linuxfoundation.org> References: <20240401152553.125349965@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 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck [ Upstream commit 4408ba75e4ba80c91fde7e10bccccf388f5c09be ] Calculating the IPv6 checksum on 32-bit systems missed overflows when adding the proto+len fields into the checksum. This results in the following unit test failure. # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:506 Expected ( u64)csum_result == ( u64)expected, but ( u64)csum_result == 46722 (0xb682) ( u64)expected == 46721 (0xb681) not ok 5 test_csum_ipv6_magic This is probably rarely seen in the real world because proto+len are usually small values which will rarely result in overflows when calculating the checksum. However, the unit test code uses large values for the length field, causing the test to fail. Fix the problem by adding the missing carry into the final checksum. Cc: Palmer Dabbelt Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Tested-by: Charlie Jenkins Reviewed-by: Charlie Jenkins Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm/checksum.h index f705e5dd10742..e619e67440db9 100644 --- a/arch/parisc/include/asm/checksum.h +++ b/arch/parisc/include/asm/checksum.h @@ -163,7 +163,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, " ldw,ma 4(%2), %7\n" /* 4th daddr */ " addc %6, %0, %0\n" " addc %7, %0, %0\n" -" addc %3, %0, %0\n" /* fold in proto+len, catch carry */ +" addc %3, %0, %0\n" /* fold in proto+len */ +" addc 0, %0, %0\n" /* add carry */ #endif : "=r" (sum), "=r" (saddr), "=r" (daddr), "=r" (len), -- 2.43.0