Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3020392rwb; Mon, 15 Aug 2022 16:17:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cU1lq5u3RRTl8NyARNBC5oCxlE7zCjn+/0shjIp4uLkSRfDvmJqiF/biaqvk9qbSPRriy X-Received: by 2002:a05:6402:27ca:b0:43e:ce64:ca07 with SMTP id c10-20020a05640227ca00b0043ece64ca07mr16982028ede.66.1660605449705; Mon, 15 Aug 2022 16:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605449; cv=none; d=google.com; s=arc-20160816; b=Zyb6lJtIbFotsDZ9JhFK0eNYez2XRBHdrmt3Jfh7AxV/RytNN0bkIBTip8Ldcn1cY5 k+Dzo1JDMPpzsy7g+1zs35CXqAkcPG2qNMsRRB9Wbjp4E7RzFtESpiH+o/vkMzO5ksjS sigTVgSM+k24oTGVT7WXvMmGdT8YStGw83n2/kZuqz4jTsHiwn4iBh/mwgkcdmvq6+1U NhDPJc7iUiRSH+EtsB4eXvrMZzxb9NFG8WiA+PnDxZltqP2/oQdUp/NGPXNohDyieDo4 q0pxXLBDcR3TeVvnMlQW3HDg53Cs9qn41zulPS6/O0HXeGa/elSXtJtXMBcQgM/cBBuP cZgg== 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=w6hpCVME9OgmiYtktf7MBwGWqRvc89DcLO1EW+pSCfilpcc0arrVfQ/OAPFCVpfmkj 7J3AOi6EwRZSRHfnYwYEPHMDAOeremYyZqgM0GSNe0VX1dZv1Q6vV42QXn+psaJizhIT 4XoeffW2i6H+xu5F1xGqT0EfAIiFgcU7FBo98bUoUjeso41eo5RAmrb26yZM8a9KLekv 24cO/Au+aPggZlyqprRI3WbLIbowadqfP7xWQCo/X/L+zBz0eEyPxRw2KmEYpp9Bcw+n +IlEKONYISk3c4njrxczXRA8tDcUbU4TNm9NJfafVhWZfigumxRdI6OmrBABEPDmAvrf f4Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L9YmSaJs; 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 l18-20020a170906795200b0073301ce958csi8715373ejo.293.2022.08.15.16.17.03; Mon, 15 Aug 2022 16:17: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=L9YmSaJs; 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 S1346979AbiHOWMk (ORCPT + 99 others); Mon, 15 Aug 2022 18:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347966AbiHOWKj (ORCPT ); Mon, 15 Aug 2022 18:10:39 -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 23E573120C; Mon, 15 Aug 2022 12:38:21 -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 9F651B80EA9; Mon, 15 Aug 2022 19:38:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0897C43470; Mon, 15 Aug 2022 19:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592294; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9YmSaJsF5H1+XdkBigBvfcO7Kd0xQOWogjoCXIlyt+JtZk7N+TDUHIaKqsQELB1W fMvdnfvMdK+Jf4eBIB1Gi1+AAsExoelLGkHS/FhlNwAkx/KZPsp89Mpij9ryzRuuPD ewJEzzrUlg+STRVrYdC0lg0i+bVBKvvPhReD0m60= 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.19 0089/1157] drm/nouveau: fix another off-by-one in nvbios_addr Date: Mon, 15 Aug 2022 19:50:45 +0200 Message-Id: <20220815180443.128672928@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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; }