net/mgmt: Remove the list node before unlocking the semaphore
net/mgmt: Remove the list node before unlocking the semaphore

The caller semaphore was released too early, this can cause the caller
to re-use the data and possibly corrupt the memory, if caller yields
and is run before this management thread. Solution is to first remove
the node from the list and then unlock the semaphore.

Change-Id: I02cef53559d776f32a5959380e6b7122cd5198c5
Signed-off-by: Tomasz Bursztyka <ba81a3a719836727e6857ae83462b9f52ec41006@linux.intel.com>

nashif/zephyr,zephyrproject-rtos/zephyr,sharronliu/zephyr,bigdinotech/zephyr,bboozzoo/zephyr,erwango/zephyr,Vudentz/zephyr,nashif/zephyr,Vudentz/zephyr,fbsder/zephyr,finikorg/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,explora26/zephyr,kraj/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,ldts/zephyr,erwango/zephyr,rsalveti/zephyr,fbsder/zephyr,runchip/zephyr-cc3220,Vudentz/zephyr,pklazy/zephyr,ldts/zephyr,sharronliu/zephyr,fbsder/zephyr,kraj/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,holtmann/zephyr,mbolivar/zephyr,galak/zephyr,bboozzoo/zephyr,explora26/zephyr,rsalveti/zephyr,holtmann/zephyr,fractalclone/zephyr-riscv,aceofall/zephyr-iotos,Vudentz/zephyr,bigdinotech/zephyr,punitvara/zephyr,fbsder/zephyr,fbsder/zephyr,holtmann/zephyr,sharronliu/zephyr,runchip/zephyr-cc3200,bigdinotech/zephyr,GiulianoFranchetto/zephyr,holtmann/zephyr,rsalveti/zephyr,runchip/zephyr-cc3220,kraj/zephyr,ldts/zephyr,runchip/zephyr-cc3220,finikorg/zephyr,erwango/zephyr,kraj/zephyr,punitvara/zephyr,punitvara/zephyr,explora26/zephyr,bboozzoo/zephyr,zephyriot/zephyr,erwango/zephyr,zephyrproject-rtos/zephyr,runchip/zephyr-cc3200,explora26/zephyr,pklazy/zephyr,pklazy/zephyr,pklazy/zephyr,aceofall/zephyr-iotos,runchip/zephyr-cc3200,holtmann/zephyr,bigdinotech/zephyr,aceofall/zephyr-iotos,mbolivar/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,galak/zephyr,aceofall/zephyr-iotos,nashif/zephyr,fractalclone/zephyr-riscv,fractalclone/zephyr-riscv,erwango/zephyr,runchip/zephyr-cc3220,mbolivar/zephyr,finikorg/zephyr,runchip/zephyr-cc3220,galak/zephyr,kraj/zephyr,mbolivar/zephyr,zephyriot/zephyr,runchip/zephyr-cc3200,galak/zephyr,fractalclone/zephyr-riscv,pklazy/zephyr,zephyriot/zephyr,galak/zephyr,bboozzoo/zephyr,sharronliu/zephyr,zephyriot/zephyr,nashif/zephyr,ldts/zephyr,ldts/zephyr,explora26/zephyr,fractalclone/zephyr-riscv,punitvara/zephyr,Vudentz/zephyr,punitvara/zephyr,sharronliu/zephyr,mbolivar/zephyr,runchip/zephyr-cc3200,nashif/zephyr,rsalveti/zephyr,bboozzoo/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,aceofall/zephyr-iotos,finikorg/zephyr,rsalveti/zephyr,bigdinotech/zephyr