Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2953820imu; Mon, 19 Nov 2018 08:33:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/UgdHBOUKXAkMrd7iN8AHj5EBW3vVuBo55iaDxCyMVhI1Cpf8P5jYDb8oyxhj8zIkx4s+g7 X-Received: by 2002:a17:902:74c1:: with SMTP id f1mr6791165plt.273.1542645216982; Mon, 19 Nov 2018 08:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645216; cv=none; d=google.com; s=arc-20160816; b=YlzIUmbIB+xBOA6J7tWOvvQkrF2GKqad9FFHWtqIvFCwu/APFY79QxjbCMgh0pyXsB p+/HKyyJEdduhGp6CmqaCm75m8o9wgItGbITT/RGxnAjLIgLyhtgmQagjtEHVSNV3PnS 3HuDmfvpcqMhx5B6nN0BSKxDSaYe6wm5jKQmuJUxxnjcI61xk/gUMi/tqB95GNkPstOq zuLVcoVRaie/V4qDTqmJlFhJTJjEJj8NPPw8bz45aqfcHFqUkglsB7AttEE/pVTLUpAs LR6vy/IIHUPlcE2Ev+LESlpV8XeyCm9kUrCR5s7fCN22SRg8Ve5kBlGHmlMPV/1tB+KS SFPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eVuX1/FCVITsCSRMXJFiw9l8iZJCsaMJVU/NGMIXyhY=; b=eAqN+GcSRCiN92n8acUYY7ra5XopiyoQFW/XW6NYMMLxhEG5pHYoJPmlXLR8QbeuZ2 YGbEoIR+TE7e7RSkZY+zwn/fSCKzbPaoZ23vZzRObqhLUvm2CbF7o6Mlrvjxf0gsJ8jP jiP+TMq7xR5Z48dLRo1juzCm7tM7I/J3rCkFnHaoae1eFhXqKhV+XZEFW/XtV4Rw2GC9 TZBuQ33SP/Dilc85AdOdisph04HCTlzYgv8Md8sV46eoROZYtc3jrsnU4JxPOHKWEjoT XzKuqB0E8ZvtKeiXZx89yizfEV8M4+g3ZwojGOZIvbV9Etf76u7bFNmK1hCQTOD9fwXr +aaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s8dtCzPK; 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 k7si39752490pgm.462.2018.11.19.08.33.19; Mon, 19 Nov 2018 08:33:36 -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; dkim=pass header.i=@kernel.org header.s=default header.b=s8dtCzPK; 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 S1730599AbeKTC4H (ORCPT + 99 others); Mon, 19 Nov 2018 21:56:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:54114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729979AbeKTC4G (ORCPT ); Mon, 19 Nov 2018 21:56:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E27B82086A; Mon, 19 Nov 2018 16:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645119; bh=lD+UJknVb8BuBli2x5yOXeTSBQ7c981777BM81llzso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8dtCzPK/Jsd+mWSJX7KBzErS47DFabF99FWIRhuhIeq/G+6pT+l3W8Koe/W+jHSS lZMfOMiUdbbXrhA2qppUauFymJTQE9idIXq4w86AnhFkmyAFj0xIGe2PMLQ+HZhn66 RE3xWgVY6+xUS4eFEKA9lv5t2ND05otBQUNoz9rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Huang Rui , Bas Nieuwenhuizen , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 043/205] drm/amdgpu: fix integer overflow test in amdgpu_bo_list_create() Date: Mon, 19 Nov 2018 17:25:50 +0100 Message-Id: <20181119162625.106303938@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit ff30e9e8509cb877dc7cbc776b36c70f5bdd290f ] We accidentally left out the size of the amdgpu_bo_list struct. It could lead to memory corruption on 32 bit systems. You'd have to pick the absolute maximum and set "num_entries == 59652323" then size would wrap to 16 bytes. Fixes: 920990cb080a ("drm/amdgpu: allocate the bo_list array after the list") Signed-off-by: Dan Carpenter Reviewed-by: Huang Rui Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Huang Rui Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -67,7 +67,8 @@ int amdgpu_bo_list_create(struct amdgpu_ unsigned i; int r; - if (num_entries > SIZE_MAX / sizeof(struct amdgpu_bo_list_entry)) + if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) + / sizeof(struct amdgpu_bo_list_entry)) return -EINVAL; size = sizeof(struct amdgpu_bo_list);