Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3929190rwi; Sat, 22 Oct 2022 02:23:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J9m5gxbK1SNkteUoyNkNDJAHgPqOdN3DHAwDNOdW3bPnmGulTMXW8aZaB/qo7WiYDblBh X-Received: by 2002:a63:1612:0:b0:461:4180:d88b with SMTP id w18-20020a631612000000b004614180d88bmr20230521pgl.434.1666430611253; Sat, 22 Oct 2022 02:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430611; cv=none; d=google.com; s=arc-20160816; b=P63ARK8ghAFbkV3Bwz4uXHp74jM+mAGQ/kFSC5TPkyhHPRQzl5/xxlW9TeblfXQiwO eqOkwpuI1muNPVafVEkwk+HKtU3ERAXmFrs7GBbBgFwM26eFNFAC72PpCAaMt9DEmKjW TyTsERQ2hdqbxFs/03UvVR/uUS7IpMTqei9B2FgnFHPKYIJU+0yRzO9epzAiCiOqokzU Hc5L3v9bEp/BAhe5eBIRgoyOk0qfrwT++7s0c6iDT2SgWU+e/YIloUNl+/cevGLQGhcJ Gpu9xz1ac4+tnqNLVFolA4Fz0isBH15UurbJa6UyIrZ3zXWtlIeWZarJ+ona2SCvzVSj 6a0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e002EOn8n0rk4BPfgZet4gShs69/B1EyLhKjERlKVww=; b=bE+SK1C+7a4PzMBddRXYaHZrRrUDMKU/GXDt2noWUFGGXwAANubKQhv9/0x8+9TLYA H0g0OGz8fmTddzOKJYp2Jm48r3Fckfl8jkJeJKeGRsYFwUVGGczklzAxJZeLaEnudsSP UlOqIz+wpP3CSP5UvBv4SL+pHCH+ts2UsHWJw+NTzEKAL6fIshnCP4uyeZwTL/0T2Gh+ e9M6mz0iD6WAJJc8U4YSeV6j5tuUW7t/KHMIu2bP03KvaaM4a3NmPRWDzSJEvY+3R0wD x6eUwydLCDoZG0A6DOQeDJoZM0wDflcY0AjrkvbnyYCKspAbbEHRHESy6ABSEy+EDO1S 48PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=htWat0Qu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a056a0015cf00b00563a93471c5si30072967pfu.101.2022.10.22.02.23.20; Sat, 22 Oct 2022 02:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=htWat0Qu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233839AbiJVIVg (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233834AbiJVITv (ORCPT ); Sat, 22 Oct 2022 04:19:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60ADC2B5B8C; Sat, 22 Oct 2022 00:58:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECACEB82E2A; Sat, 22 Oct 2022 07:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32420C433D6; Sat, 22 Oct 2022 07:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425459; bh=hofricjNNRe79eBTRgopoPwZestWeMR5bnWXab1Fj6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htWat0QuOSoy17Pqgav53Szc8WuA+P0SDuXXJNbqW5hf72+/FzBdoLL2MLVIqrPUa JLIGwf1UtgL1RtsCSc5a6xU5sRdimjxwDG2mnKzTV/ynUqDF8A/bVStIUwDMMnMTqY Dbrn0KNzPBf4SILREXnk7G4azZNaI00l3BfHsqzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Weihua , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 508/717] crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr Date: Sat, 22 Oct 2022 09:26:27 +0200 Message-Id: <20221022072520.733510815@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Weihua [ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ] KASAN reported this Bug: [17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip] There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int. Replacing param_get/set_int to param_get/set_ushort can fix this bug. Fixes: f081fda293ffb ("crypto: hisilicon - add sgl_sge_nr module param for zip") Signed-off-by: Ye Weihua Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 67869513e48c..d90b10ae005b 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -122,12 +122,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp) if (ret || n == 0 || n > HISI_ACC_SGL_SGE_NR_MAX) return -EINVAL; - return param_set_int(val, kp); + return param_set_ushort(val, kp); } static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, }; static u16 sgl_sge_nr = HZIP_SGL_SGE_NR; -- 2.35.1