1: 006f2d6aec52 ! 1: a88c970312d3 wifi: wfx: validate MIB read length before copying to caller @@ Commit message wfx_hif_read_mib() copies reply->length bytes from the firmware response into the caller-provided buffer without checking that reply->length does not exceed val_len. A firmware response with - a length field larger than expected causes a heap buffer overflow - when writing to the caller buffer. + a length field larger than expected overruns the caller buffer and + reads past the end of the reply allocation.  Replace the dead -ENOMEM check with an active validation that reply->length fits within val_len before the memcpy.  - Fixes: 9bca45f3d692 ("staging: wfx: allow to send 802.11 frames") + Fixes: f95a29d40782 ("staging: wfx: add HIF commands helpers") + Assisted-by: LLM Signed-off-by: Aamir Ahmed   ## drivers/net/wireless/silabs/wfx/hif_tx.c ## @@ drivers/net/wireless/silabs/wfx/hif_tx.c: int wfx_hif_read_mib(struct wfx_dev *w  + if (!ret && le16_to_cpu(reply->length) > val_len) { dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length)); -+ ret = -EINVAL; ++ ret = -EIO;  + } if (!ret) memcpy(val, &reply->mib_data, le16_to_cpu(reply->length));