Skip to contentSkip to conversation

Bluetooth: MGMT: Add error handling to pair_device()

PATCH Applied Griffin Kroah-Hartman 3 participants 3 messages Aug 15, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: MGMT: Add error handling to pair_device()

hci_conn_params_add() never checks for a NULL value and could lead to a NULL pointer dereference causing a crash.

Fixed by adding error handling in the function.

Cc Stable <[email protected]>
Fixes 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")
---
 net/bluetooth/mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)
net/bluetooth/mgmt.c +4 -0
index 40d4887c7f79..25979f4283a6 100644
@@ -3456,6 +3456,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 		 * will be kept and this function does nothing.
 		 */
 		p = hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
+		if (!p) {
+			err = -EIO;
+			goto unlock;
+		}
 
 		if (p->auto_connect == HCI_AUTO_CONN_EXPLICIT)
 			p->auto_connect = HCI_AUTO_CONN_DISABLED;
Signature · 1 line
2.46.0
#1 lore raw

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=879977

---Test result---

Test Summary:

CheckPatch                    FAIL      0.86 seconds
GitLint                       PASS      0.31 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      29.83 seconds
CheckAllWarning               PASS      32.48 seconds
CheckSparse                   PASS      38.47 seconds
CheckSmatch                   PASS      103.32 seconds
BuildKernel32                 PASS      29.29 seconds
TestRunnerSetup               PASS      531.73 seconds
TestRunner_l2cap-tester       PASS      20.33 seconds
TestRunner_iso-tester         PASS      35.43 seconds
TestRunner_bnep-tester        PASS      4.95 seconds
TestRunner_mgmt-tester        FAIL      114.42 seconds
TestRunner_rfcomm-tester      PASS      7.54 seconds
TestRunner_sco-tester         PASS      15.23 seconds
TestRunner_ioctl-tester       PASS      8.10 seconds
TestRunner_mesh-tester        PASS      5.98 seconds
TestRunner_smp-tester         PASS      7.01 seconds
TestRunner_userchan-tester    PASS      5.14 seconds
IncrementalBuild              PASS      28.70 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: MGMT: Add error handling to pair_device()
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #118:
hci_conn_params_add() never checks for a NULL value and could lead to a NULL

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report #123:

WARNING: Invalid email format for stable: 'Stable <[email protected]>', prefer '[email protected]' #124:
Cc: Stable <[email protected]>

total: 0 errors, 3 warnings, 0 checks, 10 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/src/13764703.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: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
LL Privacy - Remove Device 4 (Disable Adv) Timed out 2.573 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Griffin Kroah-Hartman
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 11 lines · On Thu, 15 Aug 2024 13:51:00 +0200 you wrote:

hci_conn_params_add() never checks for a NULL value and could lead to a NULL pointer dereference causing a crash.

Fixed by adding error handling in the function.

Cc Stable <[email protected]>
Fixes 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")

[...]

Here is the summary with links:
- Bluetooth: MGMT: Add error handling to pair_device()
https://git.kernel.org/bluetooth/bluetooth-next/c/f2ed8d6d8aea

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html