batman-adv: fix NULL pointer dereferences

Message ID 1398281948-3415-1-git-send-email-mareklindner@neomailbox.ch (mailing list archive)
State Superseded, archived
Commit be45ab56df4830a0f2698e948b63807a39abb64d
Headers

Commit Message

Marek Lindner April 23, 2014, 7:39 p.m. UTC
  Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 multicast.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Antonio Quartulli April 24, 2014, 11:59 a.m. UTC | #1
On 23/04/14 21:39, Marek Lindner wrote:
> Reported-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>

Acked-by: Antonio Quartulli <antonio@meshcoding.com>
  
Linus Lüssing May 2, 2014, 4:50 a.m. UTC | #2
Signed-off-by: Linus Lüssing <linus.luessing@web.de>


On Thu, Apr 24, 2014 at 03:39:08AM +0800, Marek Lindner wrote:
> Reported-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
> ---
>  multicast.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/multicast.c b/multicast.c
> index 8c7ca81..96b66fd 100644
> --- a/multicast.c
> +++ b/multicast.c
> @@ -415,7 +415,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
>  	hlist_for_each_entry_rcu(tmp_orig_node,
>  				 &bat_priv->mcast.want_all_ipv4_list,
>  				 mcast_want_all_ipv4_node) {
> -		if (!atomic_inc_not_zero(&orig_node->refcount))
> +		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
>  			continue;
>  
>  		orig_node = tmp_orig_node;
> @@ -442,7 +442,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
>  	hlist_for_each_entry_rcu(tmp_orig_node,
>  				 &bat_priv->mcast.want_all_ipv6_list,
>  				 mcast_want_all_ipv6_node) {
> -		if (!atomic_inc_not_zero(&orig_node->refcount))
> +		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
>  			continue;
>  
>  		orig_node = tmp_orig_node;
> @@ -493,7 +493,7 @@ batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv)
>  	hlist_for_each_entry_rcu(tmp_orig_node,
>  				 &bat_priv->mcast.want_all_unsnoopables_list,
>  				 mcast_want_all_unsnoopables_node) {
> -		if (!atomic_inc_not_zero(&orig_node->refcount))
> +		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
>  			continue;
>  
>  		orig_node = tmp_orig_node;
> -- 
> 2.0.0.rc0
>
  

Patch

diff --git a/multicast.c b/multicast.c
index 8c7ca81..96b66fd 100644
--- a/multicast.c
+++ b/multicast.c
@@ -415,7 +415,7 @@  batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
 	hlist_for_each_entry_rcu(tmp_orig_node,
 				 &bat_priv->mcast.want_all_ipv4_list,
 				 mcast_want_all_ipv4_node) {
-		if (!atomic_inc_not_zero(&orig_node->refcount))
+		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
 			continue;
 
 		orig_node = tmp_orig_node;
@@ -442,7 +442,7 @@  batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
 	hlist_for_each_entry_rcu(tmp_orig_node,
 				 &bat_priv->mcast.want_all_ipv6_list,
 				 mcast_want_all_ipv6_node) {
-		if (!atomic_inc_not_zero(&orig_node->refcount))
+		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
 			continue;
 
 		orig_node = tmp_orig_node;
@@ -493,7 +493,7 @@  batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv)
 	hlist_for_each_entry_rcu(tmp_orig_node,
 				 &bat_priv->mcast.want_all_unsnoopables_list,
 				 mcast_want_all_unsnoopables_node) {
-		if (!atomic_inc_not_zero(&orig_node->refcount))
+		if (!atomic_inc_not_zero(&tmp_orig_node->refcount))
 			continue;
 
 		orig_node = tmp_orig_node;