Skip to content

ieee802154: ca8210: fix stack and slab out-of-bounds accesses

Hui Peng linux-wpan lkml netdev stable 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 3/33 patches 3 repliesIn review
  2. v3 posting 2/33 patches 0 repliesSuperseded
  3. v3 posting 1/33 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v23 patches1 replySuperseded

Changes in v3 from the cover letter

- Patch 1/3: Check len > sizeof(struct mac_message) in ca8210_rx_done() where dev_crit() logs "Received packet len (%u) erroneously long" and drops the packet, instead of silently truncating the memcpy() with min_t(), addressing David Laight's feedback.

Patches in v3 posting 3/3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ieee802154: ca8210: prevent stack buffer overflow in ca8210_rx_done()drivers/net/ieee802154/ca8210.c+1 -11 reply
2/3ieee802154: ca8210: prevent stack buffer overflow in hwme_get_request_sync()drivers/net/ieee802154/ca8210.c+4 -11 reply
3/3ieee802154: ca8210: validate data_ind length upfront in ca8210_skb_rx()drivers/net/ieee802154/ca8210.c+21 -91 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchMiquel Raynal
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH net v3 0/3] ieee802154: ca8210: fix stack and slab out-of-bounds accesses

This series fixes three out-of-bounds access bugs in the Cascoda CA8210 IEEE 802.15.4 driver:

1. Reject received SPI packets with len > sizeof(struct mac_message) in ca8210_rx_done() instead of checking len > CA8210_SPI_BUF_SIZE (256), preventing a stack buffer overflow when copying a synchronous response into priv->sync_command_response (a struct mac_message on the caller's stack) and matching the actual SPI transfer length (cas_ctl->transfer.len = sizeof(struct mac_message)).
2. Initialize lenvar = 1 in ca8210_get_ed() and validate hw_attribute_length against *hw_attribute_length in hwme_get_request_sync() before memcpy() to prevent overflowing the caller's stack buffer.
3. Validate the received SPI frame length len upfront at the start of ca8210_skb_rx() before reading data_ind or allocating the skb.

Changes in v3:
- Patch 1/3: Check len > sizeof(struct mac_message) in ca8210_rx_done() where dev_crit() logs "Received packet len (%u) erroneously long" and drops the packet, instead of silently truncating the memcpy() with min_t(), addressing David Laight's feedback.

Changes in v2:
- Split the ca8210 fixes into three single-issue patches (1/3..3/3) and addressed Miquel Raynal's review comments on patches 2/3 and 3/3.

Hui Peng (3):
ieee802154: ca8210: prevent stack buffer overflow in ca8210_rx_done()
ieee802154: ca8210: prevent stack buffer overflow in
hwme_get_request_sync()
ieee802154: ca8210: validate data_ind length upfront in

    ca8210_skb_rx()
 drivers/net/ieee802154/ca8210.c | 39 +++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 12 deletions(-)
Signature · 1 line
2.49.0