* RE: mgmt: Fix heap overflow and race condition
2026-02-13 5:15 [PATCH v6 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
@ 2026-02-13 5:44 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-02-13 5:44 UTC (permalink / raw)
To: linux-bluetooth, maiquelpaiva
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: net/bluetooth/mgmt_util.c:413
error: net/bluetooth/mgmt_util.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bluetooth v7 0/1] mgmt: Fix heap overflow and race condition
@ 2026-02-13 6:04 Maiquel Paiva
2026-02-13 6:04 ` [PATCH bluetooth v7 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
0 siblings, 1 reply; 5+ messages in thread
From: Maiquel Paiva @ 2026-02-13 6:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, gregkh, marcel, Maiquel Paiva
This patch resolves two vulnerabilities in mgmt_util.c:
1. A heap buffer overflow due to missing length validation.
2. Race conditions in list handling, fixed using the existing mutex.
Changes in v7:
- Rebased explicitly onto the 'bluetooth' (fixes) tree instead of 'bluetooth-next' to resolve CI bot apply errors.
- Added base-commit info to allow 3-way merge by CI bots.
Changes in v6:
- Rebased patch onto the latest bluetooth-next tree.
Changes in v5:
- Combined both fixes into a single patch for atomic application.
- Switched to using 'mgmt_pending_lock' (mutex).
Maiquel Paiva (1):
Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling
net/bluetooth/mgmt_util.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
base-commit: 1b9c17fd0a7fdcbe69ec5d6fe8e50bc5ed7f01f2
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bluetooth v7 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling
2026-02-13 6:04 [PATCH bluetooth v7 0/1] mgmt: Fix heap overflow and race condition Maiquel Paiva
@ 2026-02-13 6:04 ` Maiquel Paiva
2026-02-13 6:55 ` mgmt: Fix heap overflow and race condition bluez.test.bot
2026-02-20 15:56 ` bluez.test.bot
0 siblings, 2 replies; 5+ messages in thread
From: Maiquel Paiva @ 2026-02-13 6:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, gregkh, marcel, Maiquel Paiva, stable
This patch addresses two issues in mesh handling:
1. Heap buffer overflow in mgmt_mesh_add:
The 'len' parameter wasn't being validated against the 'param' size,
potentially leading to an overflow. Added a check to validate user
input.
2. Race conditions in mgmt_mesh_add and mgmt_mesh_find:
These functions modify or traverse the mesh_pending list without
locking. Used guard(mutex) with the existing mgmt_pending_lock to
protect the critical sections, as suggested by maintainers.
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Cc: stable@vger.kernel.org
Signed-off-by: Maiquel Paiva <maiquelpaiva@gmail.com>
---
net/bluetooth/mgmt_util.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c
index aa7b5585cb26..eee4bc05f6e5 100644
--- a/net/bluetooth/mgmt_util.c
+++ b/net/bluetooth/mgmt_util.c
@@ -397,8 +397,7 @@ struct mgmt_mesh_tx *mgmt_mesh_find(struct hci_dev *hdev, u8 handle)
{
struct mgmt_mesh_tx *mesh_tx;
- if (list_empty(&hdev->mesh_pending))
- return NULL;
+ guard(mutex)(&hdev->mgmt_pending_lock);
list_for_each_entry(mesh_tx, &hdev->mesh_pending, list) {
if (mesh_tx->handle == handle)
@@ -413,10 +412,15 @@ struct mgmt_mesh_tx *mgmt_mesh_add(struct sock *sk, struct hci_dev *hdev,
{
struct mgmt_mesh_tx *mesh_tx;
+ if (len > sizeof(mesh_tx->param))
+ return NULL;
+
mesh_tx = kzalloc(sizeof(*mesh_tx), GFP_KERNEL);
if (!mesh_tx)
return NULL;
+ guard(mutex)(&hdev->mgmt_pending_lock);
+
hdev->mesh_send_ref++;
if (!hdev->mesh_send_ref)
hdev->mesh_send_ref++;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: mgmt: Fix heap overflow and race condition
2026-02-13 6:04 ` [PATCH bluetooth v7 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
@ 2026-02-13 6:55 ` bluez.test.bot
2026-02-20 15:56 ` bluez.test.bot
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-02-13 6:55 UTC (permalink / raw)
To: linux-bluetooth, maiquelpaiva
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: net/bluetooth/mgmt_util.c:413
error: net/bluetooth/mgmt_util.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: mgmt: Fix heap overflow and race condition
2026-02-13 6:04 ` [PATCH bluetooth v7 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
2026-02-13 6:55 ` mgmt: Fix heap overflow and race condition bluez.test.bot
@ 2026-02-20 15:56 ` bluez.test.bot
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-02-20 15:56 UTC (permalink / raw)
To: linux-bluetooth, maiquelpaiva
[-- Attachment #1: Type: text/plain, Size: 2593 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=1053791
---Test result---
Test Summary:
CheckPatch PENDING 0.44 seconds
GitLint PENDING 0.36 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 25.74 seconds
CheckAllWarning PASS 28.01 seconds
CheckSparse PASS 32.06 seconds
BuildKernel32 PASS 25.96 seconds
TestRunnerSetup PASS 564.39 seconds
TestRunner_l2cap-tester PASS 27.80 seconds
TestRunner_iso-tester PASS 89.83 seconds
TestRunner_bnep-tester PASS 6.31 seconds
TestRunner_mgmt-tester FAIL 113.20 seconds
TestRunner_rfcomm-tester PASS 9.43 seconds
TestRunner_sco-tester FAIL 14.52 seconds
TestRunner_ioctl-tester PASS 10.15 seconds
TestRunner_mesh-tester FAIL 11.61 seconds
TestRunner_smp-tester PASS 8.54 seconds
TestRunner_userchan-tester PASS 6.63 seconds
IncrementalBuild PENDING 0.91 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.104 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.831 seconds
Mesh - Send cancel - 2 Timed out 1.993 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-20 15:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-13 6:04 [PATCH bluetooth v7 0/1] mgmt: Fix heap overflow and race condition Maiquel Paiva
2026-02-13 6:04 ` [PATCH bluetooth v7 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
2026-02-13 6:55 ` mgmt: Fix heap overflow and race condition bluez.test.bot
2026-02-20 15:56 ` bluez.test.bot
-- strict thread matches above, loose matches on Subject: below --
2026-02-13 5:15 [PATCH v6 1/1] Bluetooth: mgmt: Fix heap overflow and race condition in mesh handling Maiquel Paiva
2026-02-13 5:44 ` mgmt: Fix heap overflow and race condition bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox