]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.8/firmware-tegra-bpmp-return-directly-after-a-failed-k.patch
Fixes for 6.8
[thirdparty/kernel/stable-queue.git] / queue-6.8 / firmware-tegra-bpmp-return-directly-after-a-failed-k.patch
1 From 401f68fda0d8dd118ff782637a5f163b59c32700 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 25 Dec 2023 20:03:56 +0100
4 Subject: firmware: tegra: bpmp: Return directly after a failed kzalloc() in
5 get_filename()
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 From: Markus Elfring <elfring@users.sourceforge.net>
11
12 [ Upstream commit 1315848f1f8a0100cb6f8a7187bc320c5d98947f ]
13
14 The kfree() function was called in one case by
15 the get_filename() function during error handling
16 even if the passed variable contained a null pointer.
17 This issue was detected by using the Coccinelle software.
18
19 Thus return directly after a call of the function “kzalloc” failed
20 at the beginning.
21
22 Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
23 Signed-off-by: Thierry Reding <treding@nvidia.com>
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
25 ---
26 drivers/firmware/tegra/bpmp-debugfs.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29 diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c
30 index bbcdd9fed3fb6..4221fed70ad48 100644
31 --- a/drivers/firmware/tegra/bpmp-debugfs.c
32 +++ b/drivers/firmware/tegra/bpmp-debugfs.c
33 @@ -77,7 +77,7 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
34
35 root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL);
36 if (!root_path_buf)
37 - goto out;
38 + return NULL;
39
40 root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf,
41 root_path_buf_len);
42 --
43 2.43.0
44