From: Sicong Huang <congei42@163.com>
To: nbd@nbd.name, ryder.lee@mediatek.com, shayne.chen@mediatek.com,
sean.wang@mediatek.com, kvalo@kernel.org, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com
Cc: linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Sicong Huang <congei42@163.com>
Subject: [PATCH v1] wifi: mt76: mt7615: fix null pointer dereference bug
Date: Mon, 13 May 2024 20:23:29 +0800 [thread overview]
Message-ID: <20240513122329.170380-1-congei42@163.com> (raw)
Function mt7615_coredump_work will call vzalloc to allocate a large amount
of memory space, the size of which is 1300KB. There should be a null
pointer check after vzalloc. Otherwise, when the memory allocation fails
and returns NULL, the function will cause a Kernel crash.
Signed-off-by: Sicong Huang <congei42@163.com>
---
drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index 7ba789834e8d..04eb52904520 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -2341,6 +2341,9 @@ void mt7615_coredump_work(struct work_struct *work)
}
dump = vzalloc(MT76_CONNAC_COREDUMP_SZ);
+ if(!dump)
+ return;
+
data = dump;
while (true) {
--
2.34.1
next reply other threads:[~2024-05-13 12:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 12:23 Sicong Huang [this message]
2024-05-13 13:23 ` [PATCH v1] wifi: mt76: mt7615: fix null pointer dereference bug AngeloGioacchino Del Regno
-- strict thread matches above, loose matches on Subject: below --
2024-05-13 14:34 sicong
2024-05-13 16:13 ` Lorenzo Bianconi
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=20240513122329.170380-1-congei42@163.com \
--to=congei42@163.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=kvalo@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).