mac80211: fix mesh forwarding
Subsystems (3)
Johannes Berg
maintainerPATCH 1/1 mac80211: fix mesh forwarding
From: Johannes Berg <[email protected]>
Under memory pressure, the mac80211 mesh code may helpfully print a message that it failed to clone a mesh frame and then will proceed to crash trying to use it anyway. Fix that.
--- net/mac80211/rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/rx.c +4 -1
@@ -1831,9 +1831,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 fwd_skb =skb_copy (skb,GFP_ATOMIC ); -if (!fwd_skb &&net_ratelimit ()) +if (!fwd_skb &&net_ratelimit ()) {printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , sdata->name); + goto out; + } fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;memcpy (fwd_hdr->addr2, sdata->vif.addr,ETH_ALEN );
@@ -1871,6 +1873,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 } } + out:if (is_multicast_ether_addr (hdr->addr1) || sdata->dev->flags &IFF_PROMISC )return RX_CONTINUE ;
Johannes,
Had I encountered this I would have changed the "failed to clone mesh frame" message to "I'm about to crash". Your fix is better.
Thanks!
Quoted 9 lines · Johannes Berg
From: Johannes Berg <[email protected]>
Under memory pressure, the mac80211 mesh code
may helpfully print a message that it failed
to clone a mesh frame and then will proceed
to crash trying to use it anyway. Fix that.Cc [email protected] [2.6.27+]Signed-off-by Johannes Berg <[email protected]>
Quoted 34 lines
---
net/mac80211/rx.c | 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)net/mac80211/rx.c 2010-12-22 10:06:08.000000000 +0100 renamed from net/mac80211/rx.c 2010-12-22 10:05:58.000000000 +0100 +4
-1@@ -1831,9 +1831,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 fwd_skb = skb_copy(skb, GFP_ATOMIC); - if (!fwd_skb && net_ratelimit()) + if (!fwd_skb && net_ratelimit()) { printk(KERN_DEBUG "%s: failed to clone mesh frame\n", sdata->name); + goto out; + } fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);@@ -1871,6 +1873,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 } } + out:if (
is_multicast_ether_addr(hdr->addr1)||
sdata->dev->flags &IFF_PROMISC)
returnRX_CONTINUE;--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Javier Cardona cozybit Inc. http://www.cozybit.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mac80211: fix mesh forwarding when ratelimited too
Commit b51aff057c9d0ef6c529dc25fd9f775faf7b6c63 said:
Under memory pressure, the mac80211 mesh code
may helpfully print a message that it failed
to clone a mesh frame and then will proceed
to crash trying to use it anyway. Fix that.
Avoid the reference whenever the frame copy is unsuccessful regardless of the debug message being suppressed or printed.
---
I chose a seperate if vs nesting the ratelimit check to avoid shifting the printk further to the right.
net/mac80211/rx.c +2 -2
@@ -1788,11 +1788,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) fwd_skb =skb_copy (skb,GFP_ATOMIC ); -if (!fwd_skb &&net_ratelimit ()) { +if (!fwd_skb &&net_ratelimit ())printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , sdata->name); +if (!fwd_skb) goto out; - } fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;memcpy (fwd_hdr->addr2, sdata->vif.addr,ETH_ALEN );
Johannes Berg
maintainerRe: [PATCH] mac80211: fix mesh forwarding when ratelimited too
Quoted 21 lines · Milton Miller
Commit
b51aff057c9d0ef6c529dc25fd9f775faf7b6c63said:Under memory pressure, the mac80211 mesh code
may helpfully print a message that it failed
to clone a mesh frame and then will proceed
to crash trying to use it anyway. Fix that.Avoid the reference whenever the frame copy is unsuccessful regardless of the debug message being suppressed or printed.
Cc [email protected] [2.6.27+]Signed-off-by Milton Miller <[email protected]>---
I chose a seperate if vs nesting the ratelimit check to avoid shifting the printk further to the right.net/mac80211/rx.c +0
-0
net/mac80211/rx.c ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · line 1795
Quoted 10 lines
net/mac80211/rx.c +2
-2@@ -1788,11 +1788,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) fwd_skb =skb_copy (skb,GFP_ATOMIC ); -if (!fwd_skb &&net_ratelimit ()) { +if (!fwd_skb &&net_ratelimit ())printk (KERN_DEBUG "%s: failed to clone mesh frame\n" , sdata->name); +if (!fwd_skb) goto out; - }
Oops, good catch! Thanks.
johannes