Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2889809rwb; Mon, 15 Aug 2022 13:23:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR5wJdtahKUKfCMMyhLH/V935N5n52B942Ve+TniFqW0JLH7HgsadyqxfZW/InQ8jzb+bJXq X-Received: by 2002:a05:6402:1492:b0:43d:7b8c:486e with SMTP id e18-20020a056402149200b0043d7b8c486emr16059078edv.367.1660595027576; Mon, 15 Aug 2022 13:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660595027; cv=none; d=google.com; s=arc-20160816; b=OKwm6sN2EiSGd35THx240K/LUWj0NM7RbMslcCCZF+G/0B8kg73Qpsvl0/ASDPK2pP ItUr77KR5j4Kl5xgzw5mh1HqI5AEw1vz8tibyjHixSLhOajle51mnzPRJfnPhk98I99X oZ1oeujWnrC2dQO7Aqm+u1u1uRvcBwWrUIurdzW0mdQzJOAACL5BE//6qnf3vMEco8pz 8w/xKCVKqml+wSsgW5VW6V74rn70gC0E77WqO/ekZdxI2iWNXYc6pf5EDpyFaNLpM0oj BrtyAz4xW7okzRs/93eYNqdrYGK7fUCvvtQnajdo8hRhYVd/1unqAPv60vK0uV/SZXSE bCvA== 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=Ek09EwkVaMu/N1pydJiqy4sdN7/Bz3BKqbxZBdZQZhHE9tkhn3J7che//4CMj+4/fG 9xb3IIvxYgrkYBdR4eDaGCzb5zx5ElwuDzmqC6d8eFvvAN9CwknncDEia0gWYKyCQR4a crqLq/7Rt98kQUxIJXH4kma9fL2VnDTV4GvAqtpNrY7gGIMKcc8XjUhkcGN8IvoU2N6a yuyutAQTfNvkyON7fnINwg0JE0tb9e13yEPlgDL5khziFv/5ZZ9/wMpIRtaEexZGGCL7 nS/IHapkI1BYJhAESBZKPwIX0xXkeFS7Sv5Q2R1cg2b+MO5iPCNKcUgAvCehQf0VE0SI W6xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kqS50959; 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 v18-20020a1709067d9200b0072f1c8d0e62si7766836ejo.95.2022.08.15.13.23.17; Mon, 15 Aug 2022 13:23:47 -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=kqS50959; 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 S241000AbiHOUPQ (ORCPT + 99 others); Mon, 15 Aug 2022 16:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346654AbiHOULy (ORCPT ); Mon, 15 Aug 2022 16:11:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4D549B58; Mon, 15 Aug 2022 11:58:06 -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 A399561230; Mon, 15 Aug 2022 18:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 904FEC433C1; Mon, 15 Aug 2022 18:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589885; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqS50959rYDnVY3joO1MRhORVfdAV7912OYyR7NqXgeMKzpiMteVXeIXMLbbRUkl7 clcTVPTzNIG13WAtDtEyfCa2qTZUC9o9Clp9LGHm/Euk2WtcLLHu+kWOIgDRT8rDOq fIQY6jUSU4hcyXTdFyMkj5ZuTmMfVIx+uy3i6Kzk= 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.18 0080/1095] drm/nouveau: fix another off-by-one in nvbios_addr Date: Mon, 15 Aug 2022 19:51:19 +0200 Message-Id: <20220815180432.833787907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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; }