netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mac80211: potential null dereference in mesh forwarding
@ 2011-01-03  5:43 Dan Carpenter
  2011-01-03  7:45 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-01-03  5:43 UTC (permalink / raw)
  To: John W. Linville
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	kernel-janitors

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 <error27@gmail.com>

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 5e9d3bc..dc8b566 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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;
 			}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] mac80211: potential null dereference in mesh forwarding
  2011-01-03  5:43 [patch] mac80211: potential null dereference in mesh forwarding Dan Carpenter
@ 2011-01-03  7:45 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2011-01-03  7:45 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: John W. Linville, Johannes Berg, David S. Miller, linux-wireless,
	netdev, kernel-janitors

Le lundi 03 janvier 2011 à 08:43 +0300, Dan Carpenter a écrit :
> 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 <error27@gmail.com>
> 
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 5e9d3bc..dc8b566 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -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;
>  			}

Already discovered/coped by Milton Miller.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-03  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03  5:43 [patch] mac80211: potential null dereference in mesh forwarding Dan Carpenter
2011-01-03  7:45 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).