diff options
author | Moti Haimovski <mhaimovski@habana.ai> | 2020-08-19 17:40:33 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-23 13:59:49 +0300 |
commit | 48ef8d42478f7d139a1da31f316b9736a75b6d79 (patch) | |
tree | f65ea9cbdf88b8f36aa58828b1283c603d94ceba /drivers/misc | |
parent | 201e44aeb0112177d6a6f1b59f7dbd8a87a6d02e (diff) | |
download | linux-48ef8d42478f7d139a1da31f316b9736a75b6d79.tar.xz |
habanalabs: prevent user buff overflow
[ 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 <mhaimovski@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/habanalabs/debugfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/debugfs.c b/drivers/misc/habanalabs/debugfs.c index 6c2b9cf45e83..650922061bdc 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; |