From: Zijun Hu <zijun.hu@oss.qualcomm.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
Manish Mandlik <mmandlik@google.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Zijun Hu <zijun.hu@oss.qualcomm.com>
Subject: [PATCH 1/4] Bluetooth: coredump: Fix skb leak in hci_devcd_append() stub
Date: Sun, 13 Sep 2026 20:42:56 -0700 [thread overview]
Message-ID: <20260913-misc_fix-v1-1-558c1e4028b9@oss.qualcomm.com> (raw)
In-Reply-To: <20260913-misc_fix-v1-0-558c1e4028b9@oss.qualcomm.com>
For hci_devcd_append(hdev, skb):
it consumes the skb when CONFIG_DEV_COREDUMP=y, but its stub does not free
the skb. this inconsistency causes skb leak when CONFIG_DEV_COREDUMP=n.
NXP btuart device driver encounters this leak:
btnxpuart.c:
nxp_process_fw_dump(hdev, skb)
{
...
// the skb_clone() is leaked.
err = hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC));
if (err < 0)
goto free_skb;
...
free_skb:
kfree_skb(skb); /* frees the original, not the clone */
return 0;
}
Fix by freeing the skb in the stub to keep consistent behavior.
Fixes: 9695ef876fd1 ("Bluetooth: Add support for hci devcoredump")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
include/net/bluetooth/coredump.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/net/bluetooth/coredump.h b/include/net/bluetooth/coredump.h
index acc1849f66c0..07940a1d5dd4 100644
--- a/include/net/bluetooth/coredump.h
+++ b/include/net/bluetooth/coredump.h
@@ -103,16 +103,17 @@ static inline int hci_devcd_register(struct hci_dev *hdev, coredump_t coredump,
static inline int hci_devcd_init(struct hci_dev *hdev, u32 dump_size)
{
return -EOPNOTSUPP;
}
static inline int hci_devcd_append(struct hci_dev *hdev, struct sk_buff *skb)
{
+ kfree_skb(skb);
return -EOPNOTSUPP;
}
static inline int hci_devcd_append_pattern(struct hci_dev *hdev,
u8 pattern, u32 len)
{
return -EOPNOTSUPP;
}
--
2.34.1
next prev parent reply other threads:[~2026-09-14 3:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 3:42 [PATCH 0/4] Bluetooth: Fix 2 devcoredump bugs and improve event length checks Zijun Hu
2026-09-14 3:42 ` Zijun Hu [this message]
2026-09-14 13:57 ` [PATCH 1/4] Bluetooth: coredump: Fix skb leak in hci_devcd_append() stub Luiz Augusto von Dentz
2026-09-14 16:34 ` Zijun Hu
2026-09-14 3:42 ` [PATCH 2/4] Bluetooth: coredump: Fix btmon heap-buffer-overflow Zijun Hu
2026-09-14 14:05 ` Luiz Augusto von Dentz
2026-09-14 16:16 ` Zijun Hu
2026-09-14 3:42 ` [PATCH 3/4] Bluetooth: hci_event: Use 254 as max LE Meta subevent payload length in hci_le_ev_table[] Zijun Hu
2026-09-14 3:42 ` [PATCH 4/4] Bluetooth: hci_event: Use 252 as max CC event payload length in hci_cc_table[] Zijun Hu
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=20260913-misc_fix-v1-1-558c1e4028b9@oss.qualcomm.com \
--to=zijun.hu@oss.qualcomm.com \
--cc=abhishekpandit@chromium.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=luiz.von.dentz@intel.com \
--cc=marcel@holtmann.org \
--cc=mmandlik@google.com \
--cc=zijun_hu@icloud.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®