Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp869821rwi; Wed, 19 Oct 2022 04:07:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QbAo+h6Y8bbeBmxqDeC0Ktp+sdMMyKHR8uRsYJGBpsqHq/0DU6wcasIb3l3dtyMOkb0Kn X-Received: by 2002:a17:907:6eab:b0:78d:4c16:a687 with SMTP id sh43-20020a1709076eab00b0078d4c16a687mr6198635ejc.392.1666177649146; Wed, 19 Oct 2022 04:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177649; cv=none; d=google.com; s=arc-20160816; b=JtCvs9YIITsvf08VPqeSG+EIRcKVhG2TUBcgFu4gwulaF1azMSJHsvX37sY8oSIBDz DkK2msDL2RJwLIkJ49jHowt6sjyjkDErHiqNIlM3HpYa98NYsX/rt0HTOkfGWWqILhXH zJvxUn04ZY70wFaZ+wjvs+m6WZdChc2pm8d4Ioo8dI6hsAPXVmMJzDiqPGMbVB9wCU7W ZP2KLpneUhdoTQ3Cgx/U1/vBs4s2c4OxysnCTUKVX4mBsEIy9Mcua07Vb+Cm3DNs1lB3 mOLNMSVmxorA9+C2ER7j9dHmchkMjZIGzk6lG+kiVgzSxwypIurZc6RAEv7MtlvLkqft zr4A== 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=ioykQqzDC70yjDgxYPafTemRVspFvaTwuQGnoPU+Bwo=; b=JdK856yRmc3jXJaFZ+85tSwPyjXqcHVGwCc/nsVlXsS1Ffece+/wx9U1P2X4S8WYv3 xkfIcIg0vyDhNEeLKUAAIhal+PGqFj8oCgSnJPJdcRAhvDNcug8C49p/ovZKDTNufiEY iA/z2xcSzmutCQPnIq8Qlvvu7gEh4+nfUEI4Uv4sCjyWBXfSIOIJIb7VMnNaMc4y8F0L MV5ybav84hKeeihaam4eyOskaFj+UbkklfTV9uulPe1SZw0vNgbE0qJHMl4I/LENqr0G MeM924RNXltXn8nF9w8n8RIqVdB2etQvnpLItgGn3E7itBzklvrMv1fpITfg6cODFI29 TWIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0cdfRC6r; 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 x18-20020a1709060ef200b0077a6429787dsi11537163eji.157.2022.10.19.04.06.45; Wed, 19 Oct 2022 04:07:29 -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=0cdfRC6r; 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 S233302AbiJSJSM (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbiJSJPx (ORCPT ); Wed, 19 Oct 2022 05:15:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A285B274B; Wed, 19 Oct 2022 02:06:45 -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 dfw.source.kernel.org (Postfix) with ESMTPS id C28CE6183D; Wed, 19 Oct 2022 09:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D597CC433D6; Wed, 19 Oct 2022 09:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170359; bh=M3DKLJs+12a3FysuaTwmQxqFZ8L8sCgQgxofNUcKlY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0cdfRC6r0L0tz3EO8UggJEErTN2RDO6qV7erMa2spptTmsNs83cFnwyEXkUAYVBmo 2Wif5jC8IdufMwCjWQKyKyzKQJXs3ib6hEfHuD/+sclvvwnCicp4xJJzwYID2jymdF dcglaUJFFbmQKq8u0ttZZ1nqDrJf+y8+VvYLLu5A= 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 6.0 625/862] crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr Date: Wed, 19 Oct 2022 10:31:52 +0200 Message-Id: <20221019083317.546497923@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 ad35434a3fdb..06a2d6e81ae9 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -123,12 +123,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