Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1406504lqp; Fri, 22 Mar 2024 14:01:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMHYCk/gTKJRMmlftWefM/5BvlzXLl80FIPkEcBHhVOj7y4FON4cDuRLw0zPwbaTdv2iu6ICPPOR8jz5tZ11bOFElcPWiysAlpmiWJTg== X-Google-Smtp-Source: AGHT+IGQXgnxgm231ZuWBD8MKqFYNka8+mytXgw1/NFReQ4wgICptVA7tHqw5Qa6ynBJyHqFO6A9 X-Received: by 2002:a05:6870:c6a2:b0:221:4ef3:8c00 with SMTP id cv34-20020a056870c6a200b002214ef38c00mr953801oab.59.1711141284927; Fri, 22 Mar 2024 14:01:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711141284; cv=pass; d=google.com; s=arc-20160816; b=xGM04orygxvFV/ATyUnqsHW/i+xcHE3En6Wfcq3Q3MQBcmgoKFCDnPCrD353iodI+p F3WWoAgQPXU/EVR4O70emOBX6Xsz5dYmndmIa7s/t/P95PmQSqWNtePaN/30hFvirTzA f5qTxJg1hM2kq7PRhqr1+VG4oTBM92Pxpp1qZ7H3TC2e4A4yqRCCvUOuGcL992Jma/Y+ xLXgZRMSu8FKWSwxwqxFjSZ2VpExRiBMFI85uQg1NG4HQiaBBHk4Ic0KtK3XulaYLD/J euXKesdM3o30qGFeBt7bTOLLfulOt1Qqw+BTCMOxWO4Lvikt0dd58IuaL+0XmewFE4Yw 9exg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AHaDfWqKeTOZ0MS8fprzUVNZEFZ6lLX0Zn06/jjcUO8=; fh=e7S1vF7OiGTGElQZ8MIdCndQ5vLDFzPNWdcdFYNTCYw=; b=aaUHDZfbml1a6vGWeEJFtEwSrWcjRCqGCZvSeBiu+G12f60ECPqiUKSLOOWMMLj8WA 1cwzC6wBv70xusrkYazOqMyOr2vLgVWZ0RSBkZc76NmHq8recGn+YU3e09IGcDTfIrk0 yghHGRAq1+29rOEr01mTzMU37ui6IZYbWtuGfsVTKVNcbw6p1Yd/zTRGjiXRemvcJ4b9 wmxxl95yCa1yEWsQx8my6KNXnKpXnPSxZFisCHAjZFiEvgRBF0hqlMrq3CRHNjBjs6U4 EUMTSqQZbOWHA0ldJ5xWd+9EIhj0iVEY6j3OwpYu4OY+KOtB9KpPUojs3Tqx4eHIdX1M +iTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=YcJreD3M; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-112026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112026-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r13-20020ac85c8d000000b004312051ac14si441566qta.90.2024.03.22.14.01.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 14:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=YcJreD3M; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-112026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112026-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A4C281C220B6 for ; Fri, 22 Mar 2024 21:01:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 002457FBB6; Fri, 22 Mar 2024 21:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b="YcJreD3M" Received: from mx1.t-argos.ru (mx1.t-argos.ru [109.73.34.58]) (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 D7B9C1E53A; Fri, 22 Mar 2024 21:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.73.34.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711141276; cv=none; b=n8RN25344mT8G761FO8bqh92VwKHE6WfqZ6k6pfO0SjNasxy+B+dkuJYIemfwrrOg+vbiPwouOYq9vnd2DwdsPxejP3I5OgAvM+KL78jUPjbnv6f/4b7nZwdqX5Yt/Yf8FuHVH8rYFLMb3B652MPlQka4/lknDUQJc2A8g/KDoU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711141276; c=relaxed/simple; bh=qHZQxL/07nk39dovZ4jroYtYQAGKCNn3FZb5dLi7uuM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bf0K8UvM6gJ9IQYHOxjvlP/mbUQ9Iu2bBVmQy0psxwY4+qCyl94VIUm2GYH0ghTqJFD4+9rIAi1y5oz2tyHjo2ww2sVTgt3nZnHNdfkaiV3AQvJyfJjhqieVKKQguoalNRg3FcPzSea/KUy/XO13sMC1kXuXm03Bv4TVJo7iwP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru; spf=pass smtp.mailfrom=t-argos.ru; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b=YcJreD3M; arc=none smtp.client-ip=109.73.34.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-argos.ru Received: from mx1.t-argos.ru (localhost [127.0.0.1]) by mx1.t-argos.ru (Postfix) with ESMTP id E2E7F100002; Sat, 23 Mar 2024 00:00:52 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-argos.ru; s=mail; t=1711141252; bh=AHaDfWqKeTOZ0MS8fprzUVNZEFZ6lLX0Zn06/jjcUO8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YcJreD3M2b03HXR8f2Z8GrN2oP2kikzXvI0qZ0/hl6wggjnME5zguGAmROJ3jqrvc tgSCw1+6K4B/drfyHlkKKE8HQc2kDNShSsTo+26o50fUvo0S0bfLUxW1qUQDt3yAqO Z9FX0XWPKbuMyEYo2G9JB9GDlBNYX8ofGuQP0EfncSEODxXc7dC0kpL8GbP8ByipPw H45jEZyfyAqaS56042t7QjL2ogau2+kSNYDeWyReekqKE2sXsaGEsgegkg8lOZtI2Z 03rnvt0dOiGfcUq7Mr6b9I20eJedYvnko4V9vNbeqpkbHfjURG5YKALPqSIw7CsV4Q Wrb/+V+w6ZtIg== Received: from mx1.t-argos.ru.ru (mail.t-argos.ru [172.17.13.212]) by mx1.t-argos.ru (Postfix) with ESMTP; Sat, 23 Mar 2024 00:00:05 +0300 (MSK) Received: from localhost.localdomain (172.17.215.6) by ta-mail-02 (172.17.13.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 22 Mar 2024 23:59:45 +0300 From: Aleksandr Mishin To: Herbert Xu CC: Aleksandr Mishin , "David S. Miller" , Steve Lin , Rob Rice , , , Subject: [PATCH v2] crypto: bcm/spu2 - Add buffer size check Date: Fri, 22 Mar 2024 23:59:15 +0300 Message-ID: <20240322205915.13305-1-amishin@t-argos.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240306110022.21574-1-amishin@t-argos.ru> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ta-mail-02.ta.t-argos.ru (172.17.13.212) To ta-mail-02 (172.17.13.212) X-KSMG-Rule-ID: 1 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 184367 [Mar 22 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: amishin@t-argos.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 11 0.3.11 5ecf9895443a5066245fcb91e8430edf92b1b594, {Tracking_from_domain_doesnt_match_to}, mx1.t-argos.ru.ru:7.1.1;t-argos.ru:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2024/03/22 20:48:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2024/03/22 14:30:00 #24353062 X-KSMG-AntiVirus-Status: Clean, skipped In spu2_dump_omd() value of ptr is increased by ciph_key_len instead of hash_iv_len which could lead to going beyond the buffer boundaries. Fix this bug by changing ciph_key_len to hash_iv_len. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver") Signed-off-by: Aleksandr Mishin --- v2: Fix commit message according to the Linux kernel rules drivers/crypto/bcm/spu2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/bcm/spu2.c b/drivers/crypto/bcm/spu2.c index 07989bb8c220..3fdc64b5a65e 100644 --- a/drivers/crypto/bcm/spu2.c +++ b/drivers/crypto/bcm/spu2.c @@ -495,7 +495,7 @@ static void spu2_dump_omd(u8 *omd, u16 hash_key_len, u16 ciph_key_len, if (hash_iv_len) { packet_log(" Hash IV Length %u bytes\n", hash_iv_len); packet_dump(" hash IV: ", ptr, hash_iv_len); - ptr += ciph_key_len; + ptr += hash_iv_len; } if (ciph_iv_len) { -- 2.30.2