Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4478702imw; Tue, 19 Jul 2022 07:22:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vhYnHs0TtL9du+9P0NZ2DMEpd+hduKs8VahnB7msO+y2NQZTFveQhQ7fME4h/5XjrCvo5W X-Received: by 2002:a05:6808:2105:b0:33a:85ed:bfb0 with SMTP id r5-20020a056808210500b0033a85edbfb0mr3688378oiw.21.1658240530465; Tue, 19 Jul 2022 07:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240530; cv=none; d=google.com; s=arc-20160816; b=b/f18QAoxED85JjB/JxN7LR4zXU4qAdqwaAf2BW0wxuVNh/tQoVYYIHhHhRRal/oI5 WnUrUSOTShlWJi43FfQBDyAxv+rT+nrIIB73KVA03kvXnGWTe8zkGdlOVrlUKvZ6aMoW /3VqeC7sXH2o6wNR8wubzz4MR8mBsDRv5+PFMVcp7fOZRhxXE+egSocQ56AqWZumbh0h k4GGcR0/HILlRCBTLh3tocDLKy1smP+H4bx0RD3FshthJqih0T5Baub4XTe2wy3eMvsC GOjLsQd41++HVYLluGfy8y9XSyuUKC/JWRWELiWjKINXeNflb6hOJVpVRJdT0ev1K6iQ H6TQ== 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=SN0U5r/wBEeOuYOkHMECbsm/FN5CNq4kbq0mIGo/D7Y=; b=a0LMrX/9whp4krxSI4r9/9kckdX8SFzUV4Xnya1LgHPvFB7bqwTB3Xd9eq6BmDVTHv z9UHsTFsGDK00PLF6kI8jdu+Dv9a7H8W+aym/9uXL0IQIWug4sP2Y0z7lXagFrkVyqRu cGgihjBtqEjbmfdNeb0fdwmF9qef6Nn0qkY0gQB5D9gYokTteJ2fJRr+awtf1BR86dzw V3r3cFCyzvxdKRQxqyQDR2DM1W3QuOBIiF8z5CVLaiSf50tcIXp5wilCKM3im0gp9Lef X1yP/q4RFT34aXTHmw5Lf2jJ/QqT/no99AkoTOdFeBjLUwziwMnkBzICOkQqLV0KDoWM OzZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sTVqRMrG; 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 i22-20020a9d68d6000000b00616b2ed8a18si13622390oto.154.2022.07.19.07.21.57; Tue, 19 Jul 2022 07:22:10 -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=sTVqRMrG; 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 S240989AbiGSMin (ORCPT + 99 others); Tue, 19 Jul 2022 08:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241021AbiGSMiK (ORCPT ); Tue, 19 Jul 2022 08:38:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D18A48E93; Tue, 19 Jul 2022 05:14:41 -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 CC9DEB81B2E; Tue, 19 Jul 2022 12:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AA5C341C6; Tue, 19 Jul 2022 12:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232879; bh=O9al60/sdL+jit1M+gf1vVMmjpTVz41snS5/sD9cFeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTVqRMrGbc87JV2s2PHydEd8YbDqAI7lZrnVy/L4vi5zd6vX6CStLuIejP9/Am1hk MWMdYY3lrIHPG16nM/4bcXBvWpEm7jPmifjNTNF7zIEPNExVnUeKt75Cs1B4uYQFse IKvI746Kam+efDTLYfd0NGVEX9uebXc9BxZRI13M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , =?UTF-8?q?Andr=C3=A9=20Almeida?= , Yefim Barashkin , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 098/167] drm/amd/pm: Prevent divide by zero Date: Tue, 19 Jul 2022 13:53:50 +0200 Message-Id: <20220719114705.929728889@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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: Yefim Barashkin [ Upstream commit 0638c98c17aa12fe914459c82cd178247e21fb2b ] divide error: 0000 [#1] SMP PTI CPU: 3 PID: 78925 Comm: tee Not tainted 5.15.50-1-lts #1 Hardware name: MSI MS-7A59/Z270 SLI PLUS (MS-7A59), BIOS 1.90 01/30/2018 RIP: 0010:smu_v11_0_set_fan_speed_rpm+0x11/0x110 [amdgpu] Speed is user-configurable through a file. I accidentally set it to zero, and the driver crashed. Reviewed-by: Evan Quan Reviewed-by: André Almeida Signed-off-by: Yefim Barashkin Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index e6c93396434f..614c3d049514 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -1235,6 +1235,8 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu, uint32_t crystal_clock_freq = 2500; uint32_t tach_period; + if (speed == 0) + return -EINVAL; /* * To prevent from possible overheat, some ASICs may have requirement * for minimum fan speed: -- 2.35.1