Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2869550rwb; Mon, 15 Aug 2022 13:00:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6NPytVFp69wHvkELwgfCmM8zeUC6YNfJKNrIZFwmEntsEV9l7rK25G2cqF5M2XGMNA1V+1 X-Received: by 2002:a05:6402:280f:b0:43d:f946:a895 with SMTP id h15-20020a056402280f00b0043df946a895mr16162282ede.229.1660593629456; Mon, 15 Aug 2022 13:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593629; cv=none; d=google.com; s=arc-20160816; b=igwC4b1XKswlkdxPOyLnPiB8HtJQlf8OWuLacTGJuCbzI1mEVuGmX8jfFy06KC7lZ0 NOLSWBg+sZ6pORVKuj8GHW51HMrxm97EmA8lb8J1EPUHvAFAwpdQ2wgSr3wmIYQHIMe6 gtUiB4E1VIRKZcjlYWoy4C7jqsWy1HdGiQQBzkZGbu9LWwvw2Ww6ztnhjefh/9BDRres X8ConUB58D6z840rBBKNAzMGsx36JBn40Ty55ozco/0/zBzNxQtxxme8l7go0ksinugR Wq0dJ1+5Q8bM4leKsEkKyY1oEm+BTpP+2WYLmqXLidQm3DbcAwh03SFZolwfbOGrGrLR qxBQ== 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=kuj2sTgCaxYUcQvZ5gzgtQKdB6kv2iLgHOXReaBzYVaawA7V1/cdc/MiryftRvzbSC 4JplPESASfnJnfCTWikOv//x54nUA683n1G3c0pnsihpbxgq3k3S1uFCoB2u9Q5q2/K3 M67DVTKSqUPFEskvuet7cg+uk73D0oE0izN2xUv8i3VNa8DmaZ+/YCGoolK42ma+tSS/ NywddjdNVtQy897vBW2BzQZav5xXLoCEypj+UvYPSKLY0PvWVPoGXcHpoV4gXGAM5GS3 u61wt7qEynVYrQrS2Ilc5JuqtAUqM6yN0PalzaxEPBaA1ICg83aM4sjb5u7qtK8P14a4 NRmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTmNk4ZD; 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 h9-20020a05640250c900b0043e33c1d5eesi9460101edb.230.2022.08.15.13.00.03; Mon, 15 Aug 2022 13:00: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=RTmNk4ZD; 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 S239683AbiHOSTp (ORCPT + 99 others); Mon, 15 Aug 2022 14:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240000AbiHOSSn (ORCPT ); Mon, 15 Aug 2022 14:18:43 -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 9B6422A401; Mon, 15 Aug 2022 11:16:11 -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 2C1CEB80F99; Mon, 15 Aug 2022 18:16:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A009C433D7; Mon, 15 Aug 2022 18:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587368; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTmNk4ZDlfyxb55dL4wrspY6m1ejClBbFsTJP1NsR4HaydsQR92bwLJS2fGtD7EkZ 8aHjraXM55Hj1SHIZne8pp45+8tey1OkwSpHJGSrI1PJOdb46oWiA/40bhCi1qZZ2i 8gFvvv3UPXXZbyrJyGMbL5fftC45leVo6IJ48MFA= 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.15 064/779] drm/nouveau: fix another off-by-one in nvbios_addr Date: Mon, 15 Aug 2022 19:55:08 +0200 Message-Id: <20220815180339.999848740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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; }