Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3296895pxk; Mon, 21 Sep 2020 09:59:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1CVJTMS+VcmSeidAY6y/j2iJNXghIErAYZvkHW5It2/p5IO5YQ9KNiHneKQv7khc2D1l9 X-Received: by 2002:a50:fc83:: with SMTP id f3mr650971edq.102.1600707543396; Mon, 21 Sep 2020 09:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707543; cv=none; d=google.com; s=arc-20160816; b=pf44BIcBrVIaBzHRTBgvodHxw6kxatNFZZKu67bUyMaV+vnYBEcRvtnouhAHL3e7WJ QCnSocTPwl4E4JUUD98jzq3GInTLCQSOKH67vwGEQ9gmRBHc529RZRL7lO44EXRu5N8O szEPNlip7KXHtMAgYvWYJDIxUYL90YRhr6ASWHSxcxwtA9ngWasMQQSwRc2G/yzW5Tuw FQAy2VUJ9OPWxdDgtNoRk1QQUUzhoB54u+yKoI1qvkbzZTsPWU5OinNNkkHwjJvmT0/3 YcriE4bz16jNbjqgwbflKR8y+E1tMKX2uTj0SvggN1kWKx3vGomaih+vQbALAUJj2p7j O1uQ== 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=xkrow6/QuvfyyMEieysPR5+7RS+MuKeLB8IQjzwiEqQ=; b=FMucwbu8IC0yo/Z5rT8eZwbUcLG2XjGgp8M+LWSwc6T5MQsMjthk588qp22q2jbGkv utkaaKdDd1dl9gzfJaQiNxPgjvjZVgCLI6kUXeRRoDi9wfEvBGzuB+i2OAeeFHq9u+FL 0tN8otraqZooP0h1wvWdSi22F6wWECG1nRyho0pgtxqBa5P6gkt6QjEA/+V1WzHEQN/D +qxSxSAXJejRsN+T4pu3whs9SVF51CpmtAXqj9W5BowlQu6VWFZjqnnTc6OgT7VzVhCX SzsUob+seW5M/++XARGA2OWvr8mb2u6HnTGP+NTdfxcJakoeyf/k42ad+N5CQ+Yz57uy W4Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jgTl+Ho+; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si8703520edw.144.2020.09.21.09.58.40; Mon, 21 Sep 2020 09:59:03 -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=@kernel.org header.s=default header.b=jgTl+Ho+; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729565AbgIUQnQ (ORCPT + 99 others); Mon, 21 Sep 2020 12:43:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:47470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728652AbgIUQnF (ORCPT ); Mon, 21 Sep 2020 12:43:05 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 309F7238E6; Mon, 21 Sep 2020 16:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706584; bh=3wRgz9njpE+lwA5Lwdpi4A+ePptV7i/tL3UDcDxYKGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgTl+Ho+KQpiNef1gKTzZi6LoHOegNRCuXpK2ATYSpJ6kwc8yG1SuNcGCzDlDguYF JUQ+4yKpH2aUQ1hLmR/3WH++GxZoDCkmkoAFwZxGaJJ5KPgU1dJsQtNOhtssA46LVA m5ltnlwYKNw44P7WW9KKSZ52OHU659xhhyf9Iz/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moti Haimovski , Oded Gabbay , Sasha Levin Subject: [PATCH 5.8 012/118] habanalabs: prevent user buff overflow Date: Mon, 21 Sep 2020 18:27:04 +0200 Message-Id: <20200921162036.900249682@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Moti Haimovski [ Upstream commit 6396feabf7a4104a4ddfecc00b8aac535c631a66 ] This commit fixes a potential debugfs issue that may occur when reading the clock gating mask into the user buffer since the user buffer size was not taken into consideration. Signed-off-by: Moti Haimovski Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/misc/habanalabs/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/debugfs.c b/drivers/misc/habanalabs/debugfs.c index 6c2b9cf45e831..650922061bdc7 100644 --- a/drivers/misc/habanalabs/debugfs.c +++ b/drivers/misc/habanalabs/debugfs.c @@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf, return 0; sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask); - rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf, + rc = simple_read_from_buffer(buf, count, ppos, tmp_buf, strlen(tmp_buf) + 1); return rc; -- 2.25.1