From: Henry Martin <bsdhenrymartin@gmail.com>
To: jassisinghbrar@gmail.com
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
Henry Martin <bsdhenrymartin@gmail.com>
Subject: [PATCH v1] mailbox: tegra-hsp: Fix null-ptr-deref in tegra_hsp_doorbell_create()
Date: Wed, 2 Apr 2025 22:41:15 +0800 [thread overview]
Message-ID: <20250402144115.45564-1-bsdhenrymartin@gmail.com> (raw)
devm_kstrdup_const() returns NULL when memory allocation fails.
Currently, tegra_hsp_doorbell_create() does not check for this case,
which results in a NULL pointer dereference.
Fixes: a54d03ed01b4 ("mailbox: tegra-hsp: use devm_kstrdup_const()")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
drivers/mailbox/tegra-hsp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index ed9a0bb2bcd8..147406149fec 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -293,6 +293,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
db->channel.hsp = hsp;
db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
+ if (!db->name)
+ return ERR_PTR(-ENOMEM);
db->master = master;
db->index = index;
--
2.34.1
next reply other threads:[~2025-04-02 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 14:41 Henry Martin [this message]
2025-04-02 19:31 ` [PATCH] " Markus Elfring
2025-05-08 21:54 ` [PATCH v1] " Thierry Reding
2025-05-09 6:58 ` henry martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250402144115.45564-1-bsdhenrymartin@gmail.com \
--to=bsdhenrymartin@gmail.com \
--cc=jassisinghbrar@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®