mesh: Fix segfault related to idle config write 04/234204/1
authorInga Stotland <inga.stotland@intel.com>
Thu, 2 Apr 2020 00:04:36 +0000 (17:04 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 22 May 2020 04:23:42 +0000 (09:53 +0530)
commitdc78ffa16f61f97d950c4650085cb4e6ac426d0c
tree0bf418560a039c646f4afe52841337fc2d4796e6
parentfec0e6898fcb4aa8278aebee967f7a77f9e7e1e2
mesh: Fix segfault related to idle config write

If node configuration is completely removed from the system,
remove all pending writes to the configuration file.

Fixes the segfault below:

mesh/cfgmod-server.c:node_reset() Node Reset
mesh/mesh-config-json.c:mesh_config_destroy() Delete node config /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl/00000000/0001
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl/00000000
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/node.json.bak
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/node.json
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c
Segmentation fault

Program terminated with signal SIGSEGV, Segmentation fault.

  0x0000563a35df2ed0 in ?? ()
  0x00007fd6b131689f in json_object_to_json_string_length (jso=jso@entry=0x563a35dd8d30, flags=flags@entry=2,

Change-Id: Id92320eb3f05f4bda52cff1b6e41c5345bf1df2f
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
mesh/mesh-config-json.c