In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: MGMT: fix crash in setmeshsync and setmeshcomplete
There is a BUG: KASAN: stack-out-of-bounds in setmeshsync due to memcpy from badly declared on-stack flexible array.
Another crash is in setmeshcomplete() due to double listdel via mgmtpendingvalid + mgmtpending_remove.
Use DEFINE_FLEX to declare the flexible array right, and don't memcpy outside bounds.
As mgmtpendingvalid removes the cmd from list, use mgmtpendingfree, and also report status on error.