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

Fix crash on read Networks when not connected #19588

Merged
merged 2 commits into from
Jun 16, 2022

Conversation

cecille
Copy link
Contributor

@cecille cecille commented Jun 14, 2022

Problem

Crash when reading Networks attribute if no wifi network is connected.
This happens when running the example apps on linux with the wifi
feature enabled (--wifi) because the device is actually connected
via ethernet and wifi is not connected. This could happen in a prod
device if > 1 network type was supported.

Fixes #19585

Change overview

Add a check that the iface object is valid before dereferencing.

Testing

tested using chip-tool and all 'chip-all-clusters-app --wifi' on linux.

  • armed failsafe
  • called AddOrUpdateWifiNetwork
  • read Networks attribute - no crash any more. Saw log.

This happens when running the example apps on linux with the wifi
feature enabled (--wifi) because the device is actually connected
via ethernet and wifi is not connected. This could happen in a prod
device if > 1 network type was supported.

Fixes project-chip#19585
@github-actions
Copy link

github-actions bot commented Jun 14, 2022

PR #19588: Size comparison from b006bab to f007c8f

Increases (15 builds for cc13x2_26x2, linux, nrfconnect, telink)
platform target config section b006bab f007c8f change % change
cc13x2_26x2 shell LP_CC2652R7 (read/write) 157128 157136 8 0.0
linux all-clusters-app debug (read only) 2931153 2931265 112 0.0
.rodata 259325 259357 32 0.0
.text 2495890 2495970 80 0.0
all-clusters-minimal-app debug (read only) 2776713 2776825 112 0.0
.rodata 259741 259773 32 0.0
.text 2343570 2343650 80 0.0
bridge-app debug+rpc (read only) 2258121 2258233 112 0.0
.rodata 193120 193152 32 0.0
.text 1904658 1904738 80 0.0
chip-tool debug (read only) 9821557 9821589 32 0.0
.rodata 508469 508501 32 0.0
lighting-app debug+rpc (read only) 2513449 2513593 144 0.0
.rodata 208968 209032 64 0.0
.text 2135522 2135602 80 0.0
lock-app debug (read only) 2452057 2452169 112 0.0
.rodata 222824 222856 32 0.0
.text 2065746 2065826 80 0.0
ota-provider-app debug (read only) 2289961 2290073 112 0.0
.rodata 198904 198936 32 0.0
.text 1929698 1929778 80 0.0
ota-requestor-app debug (read only) 2405705 2405849 144 0.0
.rodata 202624 202688 64 0.0
.text 2033490 2033570 80 0.0
shell debug (read only) 2608505 2608601 96 0.0
.rodata 230226 230258 32 0.0
.text 2218770 2218834 64 0.0
thermostat-no-ble arm64 (read only) 2564852 2564980 128 0.0
.rodata 162668 162716 48 0.0
.text 2164224 2164304 80 0.0
tv-app debug (read only) 3061473 3061585 112 0.0
.rodata 244640 244672 32 0.0
.text 2630690 2630770 80 0.0
tv-casting-app debug (read only) 5359745 5359777 32 0.0
.rodata 344448 344480 32 0.0
nrfconnect all-clusters-minimal-app nrf52840dk_nrf52840 text 792752 792756 4 0.0
telink lighting-app tlsr9518adk80d text 574402 574406 4 0.0
Decreases (3 builds for cc13x2_26x2, esp32, telink)
platform target config section b006bab f007c8f change % change
cc13x2_26x2 shell LP_CC2652R7 (read only) 689270 689262 -8 -0.0
.text 578832 578824 -8 -0.0
esp32 all-clusters-app c3devkit (read only) 1013902 1013900 -2 -0.0
.flash.text 1013902 1013900 -2 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 787848 787840 -8 -0.0
text 557714 557712 -2 -0.0
Full report (41 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section b006bab f007c8f change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 659119 659119 0 0.0
(read/write) 191784 191784 0 0.0
.bss 73796 73796 0 0.0
.data 3416 3416 0 0.0
.rodata 87047 87047 0 0.0
.text 571760 571760 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 645667 645667 0 0.0
(read/write) 157292 157292 0 0.0
.bss 73020 73020 0 0.0
.data 3356 3356 0 0.0
.rodata 90067 90067 0 0.0
.text 555280 555280 0 0.0
lock-ftd LP_CC2652R7 (read only) 688531 688531 0 0.0
(read/write) 153444 153444 0 0.0
.bss 71756 71756 0 0.0
.data 3280 3280 0 0.0
.rodata 98883 98883 0 0.0
.text 589164 589164 0 0.0
lock-mtd LP_CC2652R7 (read only) 637947 637947 0 0.0
(read/write) 144888 144888 0 0.0
.bss 67492 67492 0 0.0
.data 3280 3280 0 0.0
.rodata 98763 98763 0 0.0
.text 538692 538692 0 0.0
pump-app LP_CC2652R7 (read only) 669747 669747 0 0.0
(read/write) 173124 173124 0 0.0
.bss 71884 71884 0 0.0
.data 3316 3316 0 0.0
.rodata 86979 86979 0 0.0
.text 582284 582284 0 0.0
pump-controller-app LP_CC2652R7 (read only) 660471 660471 0 0.0
(read/write) 182520 182520 0 0.0
.bss 72004 72004 0 0.0
.data 3276 3276 0 0.0
.rodata 84903 84903 0 0.0
.text 575084 575084 0 0.0
shell LP_CC2652R7 (read only) 689270 689262 -8 -0.0
(read/write) 157128 157136 8 0.0
.bss 76092 76092 0 0.0
.data 3420 3420 0 0.0
.rodata 110126 110126 0 0.0
.text 578832 578824 -8 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 612202 612202 0 0.0
.app_xip_area 467836 467836 0 0.0
.bss 87288 87288 0 0.0
.data 764 764 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 609318 609318 0 0.0
.app_xip_area 464808 464808 0 0.0
.bss 87464 87464 0 0.0
.data 732 732 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 615382 615382 0 0.0
.app_xip_area 471928 471928 0 0.0
.bss 86464 86464 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 920584 920584 0 0.0
(read/write) 133456 133456 0 0.0
.bss 131336 131336 0 0.0
.data 2116 2116 0 0.0
.text 920576 920576 0 0.0
BRD4161A+rpc (read only) 956240 956240 0 0.0
(read/write) 150328 150328 0 0.0
.bss 148008 148008 0 0.0
.data 2320 2320 0 0.0
.text 956232 956232 0 0.0
BRD4161A+rs911x (read only) 795700 795700 0 0.0
(read/write) 129736 129736 0 0.0
.bss 127612 127612 0 0.0
.data 2124 2124 0 0.0
.text 795692 795692 0 0.0
lock-app BRD4161A+wf200 (read only) 963596 963596 0 0.0
(read/write) 130076 130076 0 0.0
.bss 127988 127988 0 0.0
.data 2088 2088 0 0.0
.text 963588 963588 0 0.0
window-app BRD4161A (read only) 905472 905472 0 0.0
(read/write) 133528 133528 0 0.0
.bss 131416 131416 0 0.0
.data 2108 2108 0 0.0
.text 905464 905464 0 0.0
esp32 all-clusters-app c3devkit (read only) 1013902 1013900 -2 -0.0
(read/write) 1483522 1483522 0 0.0
.dram0.bss 69424 69424 0 0.0
.dram0.data 14696 14696 0 0.0
.flash.rodata 213968 213968 0 0.0
.flash.text 1013902 1013900 -2 -0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1068115 1068115 0 0.0
(read/write) 485616 485616 0 0.0
.dram0.bss 74952 74952 0 0.0
.dram0.data 34224 34224 0 0.0
.flash.rodata 244444 244444 0 0.0
.flash.text 1062731 1062731 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 658328 658328 0 0.0
.bss 69764 69764 0 0.0
.data 2028 2028 0 0.0
.text 580736 580736 0 0.0
lock k32w061+release (read/write) 719940 719940 0 0.0
.bss 70196 70196 0 0.0
.data 2000 2000 0 0.0
.text 641944 641944 0 0.0
linux all-clusters-app debug (read only) 2931153 2931265 112 0.0
(read/write) 188720 188720 0 0.0
.bss 95808 95808 0 0.0
.data 2144 2144 0 0.0
.data.rel.ro 84552 84552 0 0.0
.dynamic 608 608 0 0.0
.got 4544 4544 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 259325 259357 32 0.0
.text 2495890 2495970 80 0.0
all-clusters-minimal-app debug (read only) 2776713 2776825 112 0.0
(read/write) 180080 180080 0 0.0
.bss 94976 94976 0 0.0
.data 2016 2016 0 0.0
.data.rel.ro 76936 76936 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 259741 259773 32 0.0
.text 2343570 2343650 80 0.0
bridge-app debug+rpc (read only) 2258121 2258233 112 0.0
(read/write) 158976 158976 0 0.0
.bss 83008 83008 0 0.0
.data 3856 3856 0 0.0
.data.rel.ro 66344 66344 0 0.0
.dynamic 608 608 0 0.0
.got 4400 4400 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 193120 193152 32 0.0
.text 1904658 1904738 80 0.0
chip-tool debug (read only) 9821557 9821589 32 0.0
(read/write) 623688 623688 0 0.0
.bss 25440 25440 0 0.0
.data 1088 1088 0 0.0
.data.rel.ro 590856 590856 0 0.0
.dynamic 624 624 0 0.0
.got 5008 5008 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 508469 508501 32 0.0
.text 7872149 7872149 0 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9580956 9580956 0 0.0
(read/write) 690049 690049 0 0.0
.bss 43697 43697 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 626288 626288 0 0.0
.dynamic 528 528 0 0.0
.got 15104 15104 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 470924 470924 0 0.0
.text 7533428 7533428 0 0.0
lighting-app debug+rpc (read only) 2513449 2513593 144 0.0
(read/write) 164088 164088 0 0.0
.bss 84608 84608 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 71496 71496 0 0.0
.dynamic 608 608 0 0.0
.got 4432 4432 0 0.0
.init 27 27 0 0.0
.init_array 816 816 0 0.0
.rodata 208968 209032 64 0.0
.text 2135522 2135602 80 0.0
lock-app debug (read only) 2452057 2452169 112 0.0
(read/write) 158680 158680 0 0.0
.bss 82976 82976 0 0.0
.data 1648 1648 0 0.0
.data.rel.ro 68184 68184 0 0.0
.dynamic 608 608 0 0.0
.got 4432 4432 0 0.0
.init 27 27 0 0.0
.init_array 784 784 0 0.0
.rodata 222824 222856 32 0.0
.text 2065746 2065826 80 0.0
ota-provider-app debug (read only) 2289961 2290073 112 0.0
(read/write) 152784 152784 0 0.0
.bss 82624 82624 0 0.0
.data 1880 1880 0 0.0
.data.rel.ro 62456 62456 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 680 680 0 0.0
.rodata 198904 198936 32 0.0
.text 1929698 1929778 80 0.0
ota-requestor-app debug (read only) 2405705 2405849 144 0.0
(read/write) 159560 159560 0 0.0
.bss 84960 84960 0 0.0
.data 2168 2168 0 0.0
.data.rel.ro 66568 66568 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 736 736 0 0.0
.rodata 202624 202688 64 0.0
.text 2033490 2033570 80 0.0
shell debug (read only) 2608505 2608601 96 0.0
(read/write) 219544 219544 0 0.0
.bss 134600 134600 0 0.0
.data 1392 1392 0 0.0
.data.rel.ro 77800 77800 0 0.0
.dynamic 608 608 0 0.0
.got 4176 4176 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 230226 230258 32 0.0
.text 2218770 2218834 64 0.0
thermostat-no-ble arm64 (read only) 2564852 2564980 128 0.0
(read/write) 191617 191617 0 0.0
.bss 99409 99409 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 82432 82432 0 0.0
.dynamic 528 528 0 0.0
.got 5080 5080 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 162668 162716 48 0.0
.text 2164224 2164304 80 0.0
tv-app debug (read only) 3061473 3061585 112 0.0
(read/write) 290088 290088 0 0.0
.bss 200232 200232 0 0.0
.data 4784 4784 0 0.0
.data.rel.ro 78624 78624 0 0.0
.dynamic 608 608 0 0.0
.got 4848 4848 0 0.0
.init 27 27 0 0.0
.init_array 952 952 0 0.0
.rodata 244640 244672 32 0.0
.text 2630690 2630770 80 0.0
tv-casting-app debug (read only) 5359745 5359777 32 0.0
(read/write) 232536 232536 0 0.0
.bss 88104 88104 0 0.0
.data 2576 2576 0 0.0
.data.rel.ro 135624 135624 0 0.0
.dynamic 608 608 0 0.0
.got 4712 4712 0 0.0
.init 27 27 0 0.0
.init_array 872 872 0 0.0
.rodata 344448 344480 32 0.0
.text 4663666 4663666 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2434816 2434816 0 0.0
.bss 209212 209212 0 0.0
.data 5864 5864 0 0.0
.text 1397460 1397460 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1199111 1199111 0 0.0
bss 141633 141633 0 0.0
rodata 156128 156128 0 0.0
text 822412 822412 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1144347 1144347 0 0.0
bss 140824 140824 0 0.0
rodata 131860 131860 0 0.0
text 792752 792756 4 0.0
p6 all-clusters-app default (read/write) 2552984 2552984 0 0.0
.bss 143424 143424 0 0.0
.data 2832 2832 0 0.0
.text 1511248 1511248 0 0.0
all-clusters-minimal-app default (read/write) 2495472 2495472 0 0.0
.bss 142640 142640 0 0.0
.data 2776 2776 0 0.0
.text 1453736 1453736 0 0.0
light-app default (read/write) 2426848 2426848 0 0.0
.bss 135752 135752 0 0.0
.data 2624 2624 0 0.0
.text 1385112 1385112 0 0.0
lock-app default (read/write) 2447256 2447256 0 0.0
.bss 135576 135576 0 0.0
.data 2600 2600 0 0.0
.text 1405520 1405520 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 787848 787840 -8 -0.0
bss 70892 70892 0 0.0
noinit 40416 40416 0 0.0
text 557714 557712 -2 -0.0
lighting-app tlsr9518adk80d (read/write) 807828 807828 0 0.0
bss 71144 71144 0 0.0
noinit 40416 40416 0 0.0
text 574402 574406 4 0.0

Copy link
Contributor

@andy31415 andy31415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems somewhat related to #19439 as well

@andy31415 andy31415 merged commit 46cdb3f into project-chip:master Jun 16, 2022
@cecille cecille deleted the linux_wifi_crash branch June 16, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seg fault when reading the Networks attribute (linux)
6 participants