* [PATCH] wl12xx: don't write out of bounds when hlid > WL12XX_MAX_LINKS
@ 2011-12-13 9:39 Luciano Coelho
2011-12-15 8:53 ` Luciano Coelho
0 siblings, 1 reply; 2+ messages in thread
From: Luciano Coelho @ 2011-12-13 9:39 UTC (permalink / raw)
To: linux-wireless; +Cc: coelho
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: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/rx.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c
index 8c277c0..4fbd2a7 100644
--- a/drivers/net/wireless/wl12xx/rx.c
+++ b/drivers/net/wireless/wl12xx/rx.c
@@ -258,8 +258,12 @@ void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status)
wl->aggr_buf + pkt_offset,
pkt_length, unaligned,
&hlid) == 1) {
- WARN_ON(hlid >= WL12XX_MAX_LINKS);
- __set_bit(hlid, active_hlids);
+ if (hlid < WL12XX_MAX_LINKS)
+ __set_bit(hlid, active_hlids);
+ else
+ WARN(1,
+ "hlid exceeded WL12XX_MAX_LINKS "
+ "(%d)\n", hlid);
}
wl->rx_counter++;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wl12xx: don't write out of bounds when hlid > WL12XX_MAX_LINKS
2011-12-13 9:39 [PATCH] wl12xx: don't write out of bounds when hlid > WL12XX_MAX_LINKS Luciano Coelho
@ 2011-12-15 8:53 ` Luciano Coelho
0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2011-12-15 8:53 UTC (permalink / raw)
To: linux-wireless
On Tue, 2011-12-13 at 11:39 +0200, Luciano Coelho wrote:
> 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: Luciano Coelho <coelho@ti.com>
> ---
Applied.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-15 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13 9:39 [PATCH] wl12xx: don't write out of bounds when hlid > WL12XX_MAX_LINKS Luciano Coelho
2011-12-15 8:53 ` Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox