Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3322655imu; Sun, 11 Nov 2018 12:21:05 -0800 (PST) X-Google-Smtp-Source: AJdET5dLpuTVWgjYXTmtP8UMJ/kyJD9B5L8RyRPCtJa2LsUeKhmXLQ5ve15AHe9NR5jaujnyZbgT X-Received: by 2002:a17:902:1006:: with SMTP id b6-v6mr16750795pla.252.1541967665518; Sun, 11 Nov 2018 12:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967665; cv=none; d=google.com; s=arc-20160816; b=yXzlqY2ZxzjrMninwoGpz8Vg8v2iedeDZbfHEL8vYB68QbHv5RNlm/muX0XxY33oJu kTIBbI6GPvzgg/Kc5IYyD/kar/CX/W6wZy2blJQ4VWSBP/MNeAX2OppMy+Buj5O3wDBb NiGcSONa2UFye+C8Iq+MMcCcOrqhDffpT9Eifg7+qZfbsaEU6k85LepnKAB3M0GdfPDv hUIg9283zKbDBvb9MMZgK2JA0JyiG9tZIvHSN7LgCpIHTQLNuhWh46g7NqWSJOWSNIvO wnEKjb1PhIPFDjg9aKxeUmuI7xF30psA2tFTecwJUzVJsLSrDf46dSVqwzFQqlQj8ZGZ oGuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=MkvqM/WIiuQXxWZZMMFfx/VC5k2bDDFTvyCvJ2Ygyw0=; b=fWCDR3WNxzEt/op2z4+K7uNtx1pLvUJvTEu9mKkPB/rwJzs7aBhf2WtfkS7xRxq3lA I9gy+65kiXR9Pi1sLG1KPaNiR9kmpM71sVYENJgnViJ3Vpo5l2XsPy5GEI0FQcL00Dqd HRQY1zsLbsJxFAPzO0FoZID7MbTGMzssxWf4fYkX6b2LtcnBn6hPhOua/eEoYudte1DA M10XObOjubFBqNMtk35uBy/yiXNyvP9JWrvNBj1dCWb5jEZ6++4IdCMrOBCCmjWXnE1Z az0s8AKRYnqyhA+B20EqAj88gbr5lx5Dnls5oQBdin1lQdbLoDyimGNKuvFsLSV7M6pt jroQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7-v6si14759377plo.100.2018.11.11.12.20.50; Sun, 11 Nov 2018 12:21:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731236AbeKLGJ2 (ORCPT + 99 others); Mon, 12 Nov 2018 01:09:28 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:53422 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbeKLGJ1 (ORCPT ); Mon, 12 Nov 2018 01:09:27 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvss-0000lF-4K; Sun, 11 Nov 2018 19:59:02 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsW-0001jc-O9; Sun, 11 Nov 2018 19:58:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dan Carpenter" , "Ben Skeggs" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 258/366] drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 7f073d011f93e92d4d225526b9ab6b8b0bbd6613 upstream. The bo array has req->nr_buffers elements so the > should be >= so we don't read beyond the end of the array. Fixes: a1606a9596e5 ("drm/nouveau: new gem pushbuf interface, bump to 0.0.16") Signed-off-by: Dan Carpenter Signed-off-by: Ben Skeggs [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -613,7 +613,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n struct nouveau_bo *nvbo; uint32_t data; - if (unlikely(r->bo_index > req->nr_buffers)) { + if (unlikely(r->bo_index >= req->nr_buffers)) { NV_ERROR(cli, "reloc bo index invalid\n"); ret = -EINVAL; break; @@ -623,7 +623,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n if (b->presumed.valid) continue; - if (unlikely(r->reloc_bo_index > req->nr_buffers)) { + if (unlikely(r->reloc_bo_index >= req->nr_buffers)) { NV_ERROR(cli, "reloc container bo index invalid\n"); ret = -EINVAL; break;