Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885015pxb; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWqswIe/rwtcGbbDOyWhqFxwqd+rE+pllc7shqzkq/L5Qlk77bhGS/Kct6QkLNg0Gyt71O X-Received: by 2002:a17:903:244d:b0:140:6573:43ce with SMTP id l13-20020a170903244d00b00140657343cemr254288pls.54.1635370045317; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370045; cv=none; d=google.com; s=arc-20160816; b=A6EvqeB7yBF1RJ6wOkxJSACqlAuLGYJzeyutxoOb4I0HzGgQvw9wy3a3qWPUcxYP1g UrkiejJgvrnLNVSBUFMAqW106E/8mVhpLcFaeb5+SoxLmWLocZBwnsOiBJgwNOQDA8L9 2AtDvJDrrFNaMQoqCSoZQ3fE+fcn95BxG7S7R2evK0YlH9bUIlTCRXnPxEdut7+u7ElM 8vzN4peQNBSW4sdLX+EqlxI8LwgrUW2gx+/U2WXuplSp7iqRrRmZGC2DkMcyzy9jxTSC oozAKfS8hn0g5xGtpZbSVggMITJiu6U3QULo+c56bDfQqwXc2IA9Os/r9UKB/DujuLha 8sAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:sender:dkim-signature; bh=ZOVIW59kKpmA3YI6MyWfAQdWikp/1S+bV4WvwADltGI=; b=VW1KVlj5H3QT2OdytbmcIt0gnrisabQRL9AVjo/gtVJJbo5DjZPHA3PToSFmf47qFK 0R/emn4/noWEHyAcqlesGKyTcTSpvu82kWWNyhaLuRwAVHIDThP81aYOkTr649293DZ2 KyeN9zYF5NVjDPavK3oDcWOqrju/sSSBsGbv9xe+X3A18wK2BaVkuSOTPvGK0a1Yg7Ms muvpzKZ4VTCb5K805DFcX9U69q/YOLI1AvsOjGz+G+pU3j7n7YO1OD1S2ksSHjdZbO8O DNq2iXeiAfViSBY2abeimPoRnyYY7H9UQKfdR8oMi9BcGpC8AqLYrW1XndTM9bI6mulP zrGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l3VHqW+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si1192652pgg.431.2021.10.27.14.27.13; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l3VHqW+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238853AbhJ0OmW (ORCPT + 97 others); Wed, 27 Oct 2021 10:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbhJ0OmQ (ORCPT ); Wed, 27 Oct 2021 10:42:16 -0400 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C33C079783 for ; Wed, 27 Oct 2021 07:39:48 -0700 (PDT) Received: by mail-oi1-x22e.google.com with SMTP id r6so3746354oiw.2 for ; Wed, 27 Oct 2021 07:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ZOVIW59kKpmA3YI6MyWfAQdWikp/1S+bV4WvwADltGI=; b=l3VHqW+goh9EHaX+7Vr/K8TAijIkOX8IUNP6+2QSVp9LQtv1as36aPVcm/F4HjQzC/ LC+2Ruoy4oEUhC2ITk9J+MX8teOSjapO+KJH1NSabDmTTKPqFkhVfb5J9jPDCw8L0JER 79INMm8w6WMacJjG0aK90648YYdIkXCdMjAZFObUvrhgMAqBEdGQgCg3J+DrbhlgTmaA YF6Vj4xML4fl0gBvveJ/6H7ETblC4ehdkPErvU967yh4nq/c08JPTZSTI/2+wXlppTdK enPzilSXE/M99mVYnlq1mWrEAsV3rIE2hKTbMk9uwfaQh9nrSquS8VmfIhkqu7p769qZ RPwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mime-version:content-disposition; bh=ZOVIW59kKpmA3YI6MyWfAQdWikp/1S+bV4WvwADltGI=; b=z2oXsriQu+gv5hvEgltlTq8PXaOXV7tWiaOYM0XCJRQK7tYSN30WiPWNXW/CUYCd/t XKyxHACKqrI7ywHlN6DV5UZLINTbWOrqt2dT8MaM0TTS7njuPoIp3dtA3t+KmIQWvTiz mKQgCaxIhZaD1TzSUp6D7QqEGuPkddxGKpP3fH12aLt5dUGxcyTh8LVGe/0GoQP0kJzb oYCW3SRzUean/3fFTFRbtmybr+z6YiM6lA9PJhl3bAVQLhY8BOeWPgYSmIfSjxEsDk4W ksjC79A45SB8BLsh6mXiJUvn9g776j48gJcWQCpcwNjiEyVRprS5xRYvh+kxAx01TQqx LZ/Q== X-Gm-Message-State: AOAM531M03WJOSIWjztpbL3cuO5Ziuknv7O9AO5fvEiXoRcEt98Zm7UU 4mW6z6qwDbbxFz6A5ONxyR8= X-Received: by 2002:a05:6808:490:: with SMTP id z16mr4119312oid.54.1635345587781; Wed, 27 Oct 2021 07:39:47 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id y123sm41791oie.0.2021.10.27.07.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 07:39:47 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 27 Oct 2021 07:39:45 -0700 From: Guenter Roeck To: Thelford Williams Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie , Alex Deucher Subject: Re: [PATCH] drm/amdgpu: fix out of bounds write Message-ID: <20211027143945.GA1947580@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 04:04:13PM -0400, Thelford Williams wrote: > Size can be any value and is user controlled resulting in overwriting the > 40 byte array wr_buf with an arbitrary length of data from buf. > > Signed-off-by: Thelford Williams > Signed-off-by: Alex Deucher The fix works, but unless I am missing something it is incomplete. parse_write_buffer_into_params() is called several times, and the size parameter is always wrong. This patch only fixes one of several instances of the problem. Guenter > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c > index 814f67d86a3c..9b3ad56607bb 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c > @@ -264,7 +264,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, > if (!wr_buf) > return -ENOSPC; > > - if (parse_write_buffer_into_params(wr_buf, size, > + if (parse_write_buffer_into_params(wr_buf, wr_buf_size, > (long *)param, buf, > max_param_num, > ¶m_nums)) { > -- > 2.33.0