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 AE90713DDDD; Thu, 11 Apr 2024 09:59:17 +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=1712829557; cv=none; b=udsoorL0KVPj/lwzsbTEpsDpVimuiY9Y6LsbtYLY2uppDyqeIJL27UP5a4/cttqifv7qhEswTCGjxznKy7f6qbQYazh0/RRBwct1tj3+mGVEXM48xJ1XGkIhcbK6XyJpVlRhLyIyG/iHEX2xcJA/Q3PLNVxadDy5hjHRUpR13s4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712829557; c=relaxed/simple; bh=SqvGI2wfieAA/0iQfvdTETNXB/PD1DPHYTSc4xYjUR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QsiyIN3XEg9Sb5K+j8GB69CYnab09AdHXr5rXxvRyO/B1b6atTfarSR6TU3ZEe7cHZntg/ginlnzZ8jS/z9tmDYyc+edZLytQY6d5Fvw+6EFti3oBMnVkyEf5m8l3R8sGTtBwTu2UtGYZv+y6pRlJ5imNcMvKL7oAJyMyvCnPnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XihZsqUV; 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="XihZsqUV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A01FC433F1; Thu, 11 Apr 2024 09:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712829557; bh=SqvGI2wfieAA/0iQfvdTETNXB/PD1DPHYTSc4xYjUR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XihZsqUVXw8Wm56+og9ZGGEzij9qtswDAnVPuLe4+4p129zLq7k70ksA9WJj3xuyw WMBBu1BTkNXh+FUMncseWrs2YnTZRb+buS32y0Ihijhqga2aDJCvbSyI+rU4L+gqa8 E2mhLVPaNKQEm3miuvXlc//NLyvn/U8LEphZjiq0= 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 4.19 027/175] parisc: Fix csum_ipv6_magic on 32-bit systems Date: Thu, 11 Apr 2024 11:54:10 +0200 Message-ID: <20240411095420.373929629@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095419.532012976@linuxfoundation.org> References: <20240411095419.532012976@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 4.19-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 7efcd901b9656..0a02639514505 100644 --- a/arch/parisc/include/asm/checksum.h +++ b/arch/parisc/include/asm/checksum.h @@ -178,7 +178,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