* [PATCH] Bluetooth: btmrvl: fix event packet length validation [not found] <CGME20260804094640eucas1p1697cf118046108ce0d9d24127f68af12@eucas1p1.samsung.com> @ 2026-08-04 9:46 ` Marek Szyprowski 2026-08-04 12:16 ` bluez.test.bot 2026-08-04 17:40 ` [PATCH] " patchwork-bot+bluetooth 0 siblings, 2 replies; 3+ messages in thread From: Marek Szyprowski @ 2026-08-04 9:46 UTC (permalink / raw) To: linux-bluetooth, linux-kernel Cc: Marek Szyprowski, Marcel Holtmann, Luiz Augusto von Dentz, Li Qiang The event length validation added by 75e574f6a212 commit used a single check against sizeof(*event), which assumed every event type uses the maximum payload size. Unfortunately event packet length depends on the type of the received event, so it must be checked separately for each event type to avoid rejecting some known well-formed events. Fixes: 75e574f6a212 ("Bluetooth: btmrvl: validate event packet lengths") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/bluetooth/btmrvl_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index aaf1614ccfd7..e25930351f64 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -81,7 +81,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) struct btmrvl_event *event; int ret = 0; - if (skb->len < sizeof(*event)) + if (skb->len <= offsetof(typeof(*event), data[0])) return -EINVAL; event = (struct btmrvl_event *) skb->data; @@ -93,6 +93,8 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) switch (event->data[0]) { case BT_EVENT_AUTO_SLEEP_MODE: + if (skb->len <= offsetof(typeof(*event), data[2])) + return -EINVAL; if (!event->data[2]) { if (event->data[1] == BT_PS_ENABLE) adapter->psmode = 1; @@ -106,6 +108,8 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) break; case BT_EVENT_HOST_SLEEP_CONFIG: + if (skb->len <= offsetof(typeof(*event), data[3])) + return -EINVAL; if (!event->data[3]) BT_DBG("gpio=%x, gap=%x", event->data[1], event->data[2]); @@ -114,6 +118,8 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) break; case BT_EVENT_HOST_SLEEP_ENABLE: + if (skb->len <= offsetof(typeof(*event), data[1])) + return -EINVAL; if (!event->data[1]) { adapter->hs_state = HS_ACTIVATED; if (adapter->psmode) @@ -126,6 +132,8 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) break; case BT_EVENT_MODULE_CFG_REQ: + if (skb->len <= offsetof(typeof(*event), data[2])) + return -EINVAL; if (priv->btmrvl_dev.sendcmdflag && event->data[1] == MODULE_BRINGUP_REQ) { BT_DBG("EVENT:%s", @@ -143,6 +151,8 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) break; case BT_EVENT_POWER_STATE: + if (skb->len <= offsetof(typeof(*event), data[1])) + return -EINVAL; if (event->data[1] == BT_PS_SLEEP) adapter->ps_state = PS_SLEEP; BT_DBG("EVENT:%s", -- 2.43.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: btmrvl: fix event packet length validation 2026-08-04 9:46 ` [PATCH] Bluetooth: btmrvl: fix event packet length validation Marek Szyprowski @ 2026-08-04 12:16 ` bluez.test.bot 2026-08-04 17:40 ` [PATCH] " patchwork-bot+bluetooth 1 sibling, 0 replies; 3+ messages in thread From: bluez.test.bot @ 2026-08-04 12:16 UTC (permalink / raw) To: linux-bluetooth, m.szyprowski [-- Attachment #1: Type: text/plain, Size: 2025 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1139978 ---Test result--- Test Summary: CheckPatch FAIL 0.53 seconds VerifyFixes PASS 0.08 seconds VerifySignedoff PASS 0.11 seconds GitLint PASS 0.21 seconds SubjectPrefix PASS 0.08 seconds BuildKernel PASS 20.71 seconds CheckAllWarning PASS 22.75 seconds CheckSparse PASS 21.66 seconds BuildKernel32 PASS 20.41 seconds CheckKernelLLVM SKIP 0.00 seconds TestRunnerSetup PASS 378.27 seconds IncrementalBuild PASS 19.10 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: Bluetooth: btmrvl: fix event packet length validation ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 75e574f6a212 ("Bluetooth: btmrvl: validate event packet lengths")' #80: The event length validation added by 75e574f6a212 commit used a single total: 1 errors, 0 warnings, 48 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/patch/14729543.patch has style problems, please review. NOTE: Ignored message types: UNKNOWN_COMMIT_ID NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: CheckKernelLLVM - SKIP Desc: Build kernel with LLVM + context analysis Output: Clang not found https://github.com/bluez/bluetooth-next/pull/531 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: btmrvl: fix event packet length validation 2026-08-04 9:46 ` [PATCH] Bluetooth: btmrvl: fix event packet length validation Marek Szyprowski 2026-08-04 12:16 ` bluez.test.bot @ 2026-08-04 17:40 ` patchwork-bot+bluetooth 1 sibling, 0 replies; 3+ messages in thread From: patchwork-bot+bluetooth @ 2026-08-04 17:40 UTC (permalink / raw) To: Marek Szyprowski Cc: linux-bluetooth, linux-kernel, marcel, luiz.dentz, liqiang01 Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 4 Aug 2026 11:46:30 +0200 you wrote: > The event length validation added by 75e574f6a212 commit used a single > check against sizeof(*event), which assumed every event type uses the > maximum payload size. Unfortunately event packet length depends on the > type of the received event, so it must be checked separately for each > event type to avoid rejecting some known well-formed events. > > Fixes: 75e574f6a212 ("Bluetooth: btmrvl: validate event packet lengths") > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > > [...] Here is the summary with links: - Bluetooth: btmrvl: fix event packet length validation https://git.kernel.org/bluetooth/bluetooth-next/c/d56d51cc0cb6 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-04 17:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20260804094640eucas1p1697cf118046108ce0d9d24127f68af12@eucas1p1.samsung.com>
2026-08-04 9:46 ` [PATCH] Bluetooth: btmrvl: fix event packet length validation Marek Szyprowski
2026-08-04 12:16 ` bluez.test.bot
2026-08-04 17:40 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox