Commit f414218e authored by Luciano Coelho's avatar Luciano Coelho

wl12xx: don't write out of bounds when hlid > WL12XX_MAX_LINKS

We should not get an hlid value bigger than WL12XX_MAX_LINKS from
wl1271_rx_handle_data().  We have a WARN_ON in case it happens.  But
despite the warning, we would still go ahead and write the hlid bit
into active_hlids (a stack variable).  This would cause us to
overwrite other data in the stack.

To avoid this problem, we now skip the write when issuing the warning,
so at least we don't corrupt data.
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 3f176494
...@@ -258,8 +258,12 @@ void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status) ...@@ -258,8 +258,12 @@ void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status)
wl->aggr_buf + pkt_offset, wl->aggr_buf + pkt_offset,
pkt_length, unaligned, pkt_length, unaligned,
&hlid) == 1) { &hlid) == 1) {
WARN_ON(hlid >= WL12XX_MAX_LINKS); if (hlid < WL12XX_MAX_LINKS)
__set_bit(hlid, active_hlids); __set_bit(hlid, active_hlids);
else
WARN(1,
"hlid exceeded WL12XX_MAX_LINKS "
"(%d)\n", hlid);
} }
wl->rx_counter++; wl->rx_counter++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment