Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PW_SID:588225] Rework parsing of HCI events #659

Closed
wants to merge 16 commits into from
Closed

Conversation

BluezTestBot
Copy link
Owner

From: Luiz Augusto von Dentz luiz.von.dentz@intel.com

This reworks the parsing of HCI events using skb_pull_data to check
event length, in addition to that it does introduce function tables to
handle events, LE subevents, Command Complete and Command Status which
simplify the callback by adding a common code that uses skb_pull_data
when parsing such events.

Luiz Augusto von Dentz (15):
skbuff: introduce skb_pull_data
Bluetooth: HCI: Use skb_pull_data to parse BR/EDR events
Bluetooth: HCI: Use skb_pull_data to parse Command Complete event
Bluetooth: HCI: Use skb_pull_data to parse Number of Complete Packets
event
Bluetooth: HCI: Use skb_pull_data to parse Inquiry Result event
Bluetooth: HCI: Use skb_pull_data to parse Inquiry Result with RSSI
event
Bluetooth: HCI: Use skb_pull_data to parse Extended Inquiry Result
event
Bluetooth: HCI: Use skb_pull_data to parse LE Metaevents
Bluetooth: HCI: Use skb_pull_data to parse LE Advertising Report event
Bluetooth: HCI: Use skb_pull_data to parse LE Ext Advertising Report
event
Bluetooth: HCI: Use skb_pull_data to parse LE Direct Advertising
Report event
Bluetooth: hci_event: Use of a function table to handle HCI events
Bluetooth: hci_event: Use of a function table to handle LE subevents
Bluetooth: hci_event: Use of a function table to handle Command
Complete
Bluetooth: hci_event: Use of a function table to handle Command Status

include/linux/skbuff.h | 2 +
include/net/bluetooth/hci.h | 59 +-

tedd-an and others added 16 commits November 30, 2021 23:37
This patch adds workflow files for ci:

[schedule_work.yml]
 - The workflow file for scheduled work
 - Sync the repo with upstream repo and rebase the workflow branch
 - Review the patches in the patchwork and creates the PR if needed

[ci.yml]
 - The workflow file for CI tasks
 - Run CI tests when PR is created

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Like skb_pull but returns the original data pointer before pulling the
data after performing a check against sbk->len.

This allows to change code that does "struct foo *p = (void *)skb->data;"
which is hard to audit and error prone, to:

        p = skb_pull_data(skb, sizeof(*p));
        if (!p)
                return;

Which is both safer and cleaner.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
This uses skb_pull_data to check the BR/EDR events received have the
minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This uses skb_pull_data to check the Command Complete events received
have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
… event

This uses skb_pull_data to check the Number of Complete Packets events
received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This uses skb_pull_data to check the Inquiry Result events received
have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
…vent

This uses skb_pull_data to check the Inquiry Result with RSSI events
received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This uses skb_pull_data to check the Extended Inquiry Result events
received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This uses skb_pull_data to check the LE Metaevents received have the
minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This uses skb_pull_data to check the LE Advertising Report events
received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
…event

This uses skb_pull_data to check the LE Extended Advertising Report
events received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
…rt event

This uses skb_pull_data to check the LE Direct Advertising Report
events received have the minimum required length.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This change the use of switch statement to a function table
which is easier to extend and can include min/max length of each HCI
event.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
This change the use of switch statement to a function table which is
easier to extend and can include min/max length of each subevent.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This change the use of switch statement to a function table which is
easier to extend and can include min/max length of each command.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This change the use of switch statement to a function table which is
easier to extend.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
@github-actions
Copy link

github-actions bot commented Dec 1, 2021

CheckPatch
Test ID: checkpatch
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Duration: 30.26 seconds
Result: FAIL
Output:

[12/15] Bluetooth: hci_event: Use of a function table to handle HCI events\CHECK:MACRO_ARG_REUSE: Macro argument reuse '_len' - possible side-effects?
#1128: FILE: net/bluetooth/hci_event.c:6957:
+#define HCI_EV(_op, _func, _len) \
+	HCI_EV_VL(_op, _func, _len, _len)

CHECK:MACRO_ARG_REUSE: Macro argument reuse '_len' - possible side-effects?
#1142: FILE: net/bluetooth/hci_event.c:6971:
+#define HCI_EV_REQ(_op, _func, _len) \
+	HCI_EV_REQ_VL(_op, _func, _len, _len)

total: 0 errors, 0 warnings, 2 checks, 1414 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/12648769.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.

[13/15] Bluetooth: hci_event: Use of a function table to handle LE subevents\CHECK:MACRO_ARG_REUSE: Macro argument reuse '_len' - possible side-effects?
#355: FILE: net/bluetooth/hci_event.c:6742:
+#define HCI_LE_EV(_op, _func, _len) \
+	HCI_LE_EV_VL(_op, _func, _len, _len)

total: 0 errors, 0 warnings, 1 checks, 367 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/12648771.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.

[14/15] Bluetooth: hci_event: Use of a function table to handle Command Complete\CHECK:MACRO_ARG_REUSE: Macro argument reuse '_len' - possible side-effects?
#2924: FILE: net/bluetooth/hci_event.c:3722:
+#define HCI_CC(_op, _func, _len) \
+	HCI_CC_VL(_op, _func, _len, _len)

total: 0 errors, 0 warnings, 1 checks, 3030 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/12648775.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.

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

GitLint
Test ID: gitlint
Desc: Run gitlint with rule in .gitlint
Duration: 10.96 seconds
Result: FAIL
Output:

[04/15] Bluetooth: HCI: Use skb_pull_data to parse Number of Complete Packets event
1: T1 Title exceeds max length (83>80): "[04/15] Bluetooth: HCI: Use skb_pull_data to parse Number of Complete Packets event"

[06/15] Bluetooth: HCI: Use skb_pull_data to parse Inquiry Result with RSSI event
1: T1 Title exceeds max length (81>80): "[06/15] Bluetooth: HCI: Use skb_pull_data to parse Inquiry Result with RSSI event"

[10/15] Bluetooth: HCI: Use skb_pull_data to parse LE Ext Advertising Report event
1: T1 Title exceeds max length (82>80): "[10/15] Bluetooth: HCI: Use skb_pull_data to parse LE Ext Advertising Report event"

[11/15] Bluetooth: HCI: Use skb_pull_data to parse LE Direct Advertising Report event
1: T1 Title exceeds max length (85>80): "[11/15] Bluetooth: HCI: Use skb_pull_data to parse LE Direct Advertising Report event"

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

BuildKernel
Test ID: buildkernel
Desc: Build Kernel with minimal configuration supports Bluetooth
Duration: 748.60 seconds
Result: PASS

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: Setup
Test ID: testrunnersetup
Desc: Setup environment for running Test Runner
Duration: 539.43 seconds
Result: PASS

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: l2cap-tester
Test ID: testrunnerl2cap-tester
Desc: Run test-runner with l2cap-tester
Duration: 13.66 seconds
Result: PASS
Output:

Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: bnep-tester
Test ID: testrunnerbnep-tester
Desc: Run test-runner with bnep-tester
Duration: 6.67 seconds
Result: PASS
Output:

Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: mgmt-tester
Test ID: testrunnermgmt-tester
Desc: Run test-runner with mgmt-tester
Duration: 129.43 seconds
Result: PASS
Output:

Total: 493, Passed: 492 (99.8%), Failed: 0, Not Run: 1

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: rfcomm-tester
Test ID: testrunnerrfcomm-tester
Desc: Run test-runner with rfcomm-tester
Duration: 8.53 seconds
Result: PASS
Output:

Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: sco-tester
Test ID: testrunnersco-tester
Desc: Run test-runner with sco-tester
Duration: 8.85 seconds
Result: PASS
Output:

Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: smp-tester
Test ID: testrunnersmp-tester
Desc: Run test-runner with smp-tester
Duration: 8.50 seconds
Result: PASS
Output:

Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

TestRunner: userchan-tester
Test ID: testrunneruserchan-tester
Desc: Run test-runner with userchan-tester
Duration: 7.10 seconds
Result: PASS
Output:

Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0

@github-actions github-actions bot force-pushed the workflow branch 3 times, most recently from 329f682 to 7005ccd Compare December 1, 2021 04:51
@github-actions github-actions bot force-pushed the workflow branch 15 times, most recently from b9b1f01 to acc09f8 Compare December 1, 2021 19:32
@BluezTestBot BluezTestBot deleted the 588225 branch December 1, 2021 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants