Skip to content

bt_le_scan_stop() before finding device results in Data Access Violation #13972

@lanvis

Description

@lanvis

Describe the bug
Stopping scan via bt_le_scan_stop() called from a timer callback expiration without finding the target device results in Data Access Violation.

Violation occurs here:
Bluetooth initialized
Scanning successfully started
:bleSM: running
...BLE_GAP_EVT_TIMEOUT = 0x0019
Scan stopped
***** MPU FAULT *****
Data Access Violation
MMFAR Address: 0x0
***** Hardware exception *****
Current thread ID = 0x20000728
Faulting instruction address = 0x1b49c
Fatal fault in thread 0x20000728! Aborting.

This is HERE:
0001b498 <sys_dlist_remove>:
node->prev->next = node->next;
1b498: e9d0 2300 ldrd r2, r3, [r0]
1b49c: 601a str r2, [r3, #0]
node->next->prev = node->prev;
1b49e: 6802 ldr r2, [r0, #0]
1b4a0: 6053 str r3, [r2, #4]
node->next = NULL;
1b4a2: 2300 movs r3, #0
node->prev = NULL;
1b4a4: e9c0 3300 strd r3, r3, [r0]
}
1b4a8: 4770 bx lr

BugsXfer.zip

To Reproduce

  1. Build Zephyr as a BLE central.
  2. Set primary service scan with scan params.
  3. Start the scan. Start a timer that times out and stops the current scan.

.type = (BT_HCI_LE_SCAN_PASSIVE),
.filter_dup = 0,
.interval = SCAN_INTERVAL=25,
.window = SCAN_WINDOW=25
};

*Expected behavior
Scanning should stop without signalling an exception.

Impact
Not stopping scanning for now ....

Screenshots or console output
Attached is .lst file and .map file.

Environment (please complete the following information):
OS: Ubuntu 16.4
Toolchain: Zephyr SDK
Version: OS 1.13.99

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

area: BluetoothbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions