mac80211: potential null dereference in mesh forwarding
Subsystems (4)
PATCH 1/1 mac80211: potential null dereference in mesh forwarding
The printk() is supposed to be ratelimited but we should always goto out when fwd_skb is NULL. Otherwise it gets dereferenced on the next line.
Signed-off-by Dan Carpenter <[email protected]>
net/mac80211/rx.c +3 -2
@@ -1831,8 +1831,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) fwd_skb =skb_copy (skb,GFP_ATOMIC ); -if (!fwd_skb &&net_ratelimit ()) { -printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , +if (!fwd_skb) { +if (net_ratelimit ()) +printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , sdata->name); goto out; }
Quoted 11 lines · Dan Carpenter
The
printk()is supposed to be ratelimited but we should always goto out whenfwd_skbis NULL. Otherwise it gets dereferenced on the next line.Signed-off-by Dan Carpenter <[email protected]>net/mac80211/rx.c +0
-0@@ -1831,8 +1831,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
net/mac80211/rx.c ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · line 1839
Quoted 10 lines
net/mac80211/rx.c +3
-2fwd_skb =skb_copy (skb,GFP_ATOMIC ); -if (!fwd_skb &&net_ratelimit ()) { -printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , +if (!fwd_skb) { +if (net_ratelimit ()) +printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , sdata->name); goto out; }
Already discovered/coped by Milton Miller.