kernel: fix mailbox usage of SYS_DLIST_FOR_EACH_NODE()
kernel: fix mailbox usage of SYS_DLIST_FOR_EACH_NODE()

SYS_DLIST_FOR_EACH_NODE() is marked as non-safe when an item is removed
from the list while looping over it. This is not true per-se, since the
item, when removed, keeps its next and prev pointers intact; however, it
is true if the item is then put into a list, be it a different one or
the same one. To prevent this, SYS_DLIST_FOR_EACH_NODE_SAFE() must be
used.

_mbox_message_put() can remove items from the rx queue and then put them
in the ready queue: this would cause the loop to start processing other
ready threads as item in the rx queue.

k_mbox_get() also removes items, from the tx queue, but does not seem to
add them to another list; however, it now uses the safe version as well,
since that is the proper usage.

Change-Id: Ieccbff238fc8a036c0d53d873eaaf55f4f5a14af
Signed-off-by: Benjamin Walsh <578db18f23ec223e50c404886c947386478a464e@windriver.com>
Signed-off-by: Anas Nashif <0d9952ec84ac43c159f6b7e7ed99a9080c00dd6e@intel.com>

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