diff mbox series

Bluetooth: MGMT: Add error handling to pair_device()

Message ID 20240815115100.13100-1-griffin@kroah.com (mailing list archive)
State Accepted
Commit f2ed8d6d8aea7d1def44f3b8ea713460299389d1
Headers show
Series Bluetooth: MGMT: Add error handling to pair_device() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning 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: Reported-by: Yiwei Zhang <zhan4630@purdue.edu> Cc: Stable <stable@kernel.org> WARNING: Invalid email format for stable: 'Stable <stable@kernel.org>', prefer 'stable@kernel.org' #124: Cc: Stable <stable@kernel.org> 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.
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester fail TestRunner_mgmt-tester: Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Griffin Kroah-Hartman Aug. 15, 2024, 11:51 a.m. UTC
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.

Reported-by: Yiwei Zhang <zhan4630@purdue.edu>
Cc: Stable <stable@kernel.org>
Fixes: 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")
Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
---
 net/bluetooth/mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

bluez.test.bot@gmail.com Aug. 15, 2024, 12:44 p.m. UTC | #1
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: 
Reported-by: Yiwei Zhang <zhan4630@purdue.edu>
Cc: Stable <stable@kernel.org>

WARNING: Invalid email format for stable: 'Stable <stable@kernel.org>', prefer 'stable@kernel.org'
#124: 
Cc: Stable <stable@kernel.org>

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
patchwork-bot+bluetooth@kernel.org Aug. 15, 2024, 4 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

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.
> 
> Reported-by: Yiwei Zhang <zhan4630@purdue.edu>
> Cc: Stable <stable@kernel.org>
> Fixes: 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")
> Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 40d4887c7f79..25979f4283a6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -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;