Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860644rwb; Fri, 19 Aug 2022 10:35:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR4rG2tetgdgvvlqzD/UxHRi5fSvpqqNz4F0iyfolZYjgP9habpVQhm0vni9ZiQA/swSe2oR X-Received: by 2002:a17:902:ea02:b0:16f:11bf:f018 with SMTP id s2-20020a170902ea0200b0016f11bff018mr8157863plg.150.1660930526643; Fri, 19 Aug 2022 10:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930526; cv=none; d=google.com; s=arc-20160816; b=EgsJsLbHER/OYNZ0n6tg2rvm3Ah+LlIRqJx9wqJVsh/K+vlPEyeTHnQoOkGOIkxoYX Lx/LvhchjxbLP8kxUf05o7Pf2ZvFoIvjHgS3jlXO9PadOIjNvPd9UmXxNb1Dwz+bjXUR ZNFCV0e0RFYypDKMFShXitW3ymq+WJ08rxHVlGvzjLp05zgnMJCY68D9jqjqPU3JM4hU hkpOoCMbMxYVALDWRPlGuF5ejr6zA0YXZhC0FY/x7MQkGcjP0hGjPDgjXyuUB6ImH4t0 MjMwZrr8ks/yusHKtXiikGAtxGRSDTP4XJnxtL87KBJrO8O81a227b6tn8aLyjq9wqNs rxAA== 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=myCIKb/pn6op1H9jlUEmVoL0FbUEJMei1LS/2X5rxLU=; b=psxfAjVzwOiYEcEdzYbPCn0mhcEbnu6EWOyJIoQkOYDk9tvG/woOS218zJk7YxCzlU JFU6y87CseW0nPnZktEd0U93at2pD2GOtAbxsiPbGUf+H9iIP6GE+HTKXbyllG/zRfDh FfQPt4QqCY6L4jhevKsPTGmASAsvaKs2n7qQADSs+nQ9LQXc7GJTgZl5av6eLydHpoBi 6wel0q0GKTaXklvXnquDuYr56mWqaRjlyjHdS6DVRkd6SruEG3vqkrcIjFJguEnWePrR x8UcUAw1tcELj0zLCcxyANDiIzDoWZmVWkLuw1EMsAhcLaZwQ0Y2SwzL1h4bHTERW7+r nl6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsQGqy9X; 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 l184-20020a6388c1000000b0041b2d206897si4344804pgd.804.2022.08.19.10.35.15; Fri, 19 Aug 2022 10:35:26 -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=tsQGqy9X; 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 S1350366AbiHSPuX (ORCPT + 99 others); Fri, 19 Aug 2022 11:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350317AbiHSPti (ORCPT ); Fri, 19 Aug 2022 11:49:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD939104B2C; Fri, 19 Aug 2022 08:47:49 -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 A452B616B3; Fri, 19 Aug 2022 15:47:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F3BC433D6; Fri, 19 Aug 2022 15:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924068; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsQGqy9Xm5jKxEt35hVXgQq1EA1qbIUlQuOCnG0ed5PxNPhSL9SYqWHCVjiPw4WIK pReB1JPbheRDnag+U0LdxMCcB+JJXfZD9uiYjjzqK5bMSmAUE7Y7gdkaKsUEvacSL3 i/T/I9Eh4iLIy2H/kjHKbtjUsN5njUGQKztUHDFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timur Tabi , Karol Herbst , Lyude Paul Subject: [PATCH 5.10 044/545] drm/nouveau: fix another off-by-one in nvbios_addr Date: Fri, 19 Aug 2022 17:36:54 +0200 Message-Id: <20220819153831.183858332@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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.1 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,T_SCC_BODY_TEXT_LINE 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: Timur Tabi commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream. This check determines whether a given address is part of image 0 or image 1. Image 1 starts at offset image0_size, so that address should be included. Fixes: 4d4e9907ff572 ("drm/nouveau/bios: guard against out-of-bounds accesses to image") Cc: # v4.8+ Signed-off-by: Timur Tabi Reviewed-by: Karol Herbst Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220511163716.3520591-1-ttabi@nvidia.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c @@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 { u32 p = *addr; - if (*addr > bios->image0_size && bios->imaged_addr) { + if (*addr >= bios->image0_size && bios->imaged_addr) { *addr -= bios->image0_size; *addr += bios->imaged_addr; }