Skip to content

Commit f39ea26

Browse files
chrisbainbridgejmberg-intel
authored andcommitted
mac80211: fix use of uninitialised values in RX aggregation
Use kzalloc instead of kmalloc for struct tid_ampdu_rx to initialize the "removed" field (all others are initialized manually). That fixes: UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29 load of value 2 is not a valid value for type '_Bool' CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265 Workqueue: phy0 rt2x00usb_work_rxdone 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007 ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500 ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032 Call Trace: [<ffffffff8181d866>] dump_stack+0x45/0x5f [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40 [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70 [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730 [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00 [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750 [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990 While at it, convert to use sizeof(*tid_agg_rx) instead. Fixes: 788211d ("mac80211: fix RX A-MPDU session reorder timer deletion") Cc: [email protected] Signed-off-by: Chris Bainbridge <[email protected]> [reword commit message, use sizeof(*tid_agg_rx)] Signed-off-by: Johannes Berg <[email protected]>
1 parent cb150b9 commit f39ea26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/mac80211/agg-rx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
291291
}
292292

293293
/* prepare A-MPDU MLME for Rx aggregation */
294-
tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
294+
tid_agg_rx = kzalloc(sizeof(*tid_agg_rx), GFP_KERNEL);
295295
if (!tid_agg_rx)
296296
goto end;
297297

0 commit comments

Comments
 (0)