adapter: Don't refresh adv_manager for non-LE devices 68/204968/1
authorantoine.belvire@laposte.net <antoine.belvire@laposte.net>
Tue, 27 Mar 2018 18:30:26 +0000 (20:30 +0200)
committerAmit Purwar <amit.purwar@samsung.com>
Fri, 26 Apr 2019 10:55:29 +0000 (16:25 +0530)
commit9a85fddc0bfe1b0b59dba6dfa64a05c6f7c9a865
tree8fcc52b8451ceb63be00d5641c955a5a00d8118a
parent4293fc5fbe47efcb2e1e44e2357a2575848ac978
adapter: Don't refresh adv_manager for non-LE devices

btd_adv_manager_refresh is called upon MGMT_SETTING_DISCOVERABLE setting change
but as only LE adapters have an adv_manager, this leads to segmentation fault
for non-LE devices:

0  btd_adv_manager_refresh (manager=0x0) at src/advertising.c:1176
1  0x0000556fe45fcb02 in settings_changed (settings=<optimized out>,
    adapter=0x556fe53f7c70) at src/adapter.c:543
2  new_settings_callback (index=<optimized out>, length=<optimized out>,
    param=<optimized out>, user_data=0x556fe53f7c70) at src/adapter.c:573
3  0x0000556fe462c278 in request_complete (mgmt=mgmt@entry=0x556fe53f20c0,
    status=<optimized out>, opcode=opcode@entry=7, index=index@entry=0,
    length=length@entry=4, param=0x556fe53eb5f9) at src/shared/mgmt.c:261
4  0x0000556fe462cd9d in can_read_data (io=<optimized out>,
    user_data=0x556fe53f20c0) at src/shared/mgmt.c:353
5  0x0000556fe46396e3 in watch_callback (channel=<optimized out>,
    cond=<optimized out>, user_data=<optimized out>)
    at src/shared/io-glib.c:170
6  0x00007fe351c980e5 in g_main_context_dispatch ()
   from /usr/lib64/libglib-2.0.so.0
7  0x00007fe351c984b0 in ?? () from /usr/lib64/libglib-2.0.so.0
8  0x00007fe351c987c2 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
9  0x0000556fe45abc75 in main (argc=<optimized out>, argv=<optimized out>)
    at src/main.c:770

This commit prevents the call to btd_adv_manager_refresh for non-LE devices.

Change-Id: Ibc9d6631cf5f3918fc4078fc39b87d54c7643497
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/adapter.c