Message ID | 20200910235707.7732-2-prestwoj@gmail.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Johannes Berg |
Headers | show |
Series | Hwsim crash when receiving cloned frame | expand |
On Thu, 2020-09-10 at 16:57 -0700, James Prestwood wrote: > This crash has rarely happened to me on bare metal, but when running > in a virtual environment it happens much more frequently. It would > appear that the mac80211_hwsim_data (data2) obtained from > get_hwsim_data_ref_from_addr() is not fully initialized. When the > crash happens the 'channel' member (ieee80211_channel*) is NULL. This > is not checked for and eventually dereferenced which causes the > segmentation fault. Seems reasonable to me. I guess data2 is somehow getting packets delivered but never even started operating. johannes
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 1356e8cbe617..c6a5987e9933 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3506,7 +3506,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, skb_put_data(skb, frame_data, frame_data_len); data2 = get_hwsim_data_ref_from_addr(dst); - if (!data2) + if (!data2 || !data2->channel) goto out; if (!hwsim_virtio_enabled) {