Commit 70d251b2 authored by Senthil Balasubramanian's avatar Senthil Balasubramanian Committed by John W. Linville

mac80211: Fix for NULL pointer dereference in sta_info_get()

This addresses a NULL pointer dereference in sta_info_get().
TID and sta_info are extracted in ADDBA Timer expiry function
through the timer handler's argument.

The problem is extracging the TID (which was stored in
timer_to_tid[] array of type "u8") through "int *" typecast which
may also yield unwanted bytes for the MSB of TID that results
in incorrect sta_info and ieee80211_local pointers.

ieee80211_local pointer is NULL as illustrated below, it crashes in
sta_info_get(). The problem started when extracting ieee80211_local
pointer out of sta_info iteself and eventually crashed in
stat_info_get().

The proper way to fix is to change the data type of TID to u8
instead of u16. However changing all the occurences requires
some prototype changes as well. We should fix this in upcoming
patches.
Signed-off-by: default avatarSenthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: default avatarLuis Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f6d97104
...@@ -1614,7 +1614,7 @@ void sta_addba_resp_timer_expired(unsigned long data) ...@@ -1614,7 +1614,7 @@ void sta_addba_resp_timer_expired(unsigned long data)
* only one argument, and both sta_info and TID are needed, so init * only one argument, and both sta_info and TID are needed, so init
* flow in sta_info_create gives the TID as data, while the timer_to_id * flow in sta_info_create gives the TID as data, while the timer_to_id
* array gives the sta through container_of */ * array gives the sta through container_of */
u16 tid = *(int *)data; u16 tid = *(u8 *)data;
struct sta_info *temp_sta = container_of((void *)data, struct sta_info *temp_sta = container_of((void *)data,
struct sta_info, timer_to_tid[tid]); struct sta_info, timer_to_tid[tid]);
...@@ -1662,7 +1662,7 @@ void sta_addba_resp_timer_expired(unsigned long data) ...@@ -1662,7 +1662,7 @@ void sta_addba_resp_timer_expired(unsigned long data)
void sta_rx_agg_session_timer_expired(unsigned long data) void sta_rx_agg_session_timer_expired(unsigned long data)
{ {
/* not an elegant detour, but there is no choice as the timer passes /* not an elegant detour, but there is no choice as the timer passes
* only one argument, and verious sta_info are needed here, so init * only one argument, and various sta_info are needed here, so init
* flow in sta_info_create gives the TID as data, while the timer_to_id * flow in sta_info_create gives the TID as data, while the timer_to_id
* array gives the sta through container_of */ * array gives the sta through container_of */
u8 *ptid = (u8 *)data; u8 *ptid = (u8 *)data;
......
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