mbox

pull request [net]: batman-adv 20160216

Message ID 1455634888-29400-1-git-send-email-a@unstable.cc (mailing list archive)
State Not Applicable, archived
Headers

Pull-request

git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

Message

Antonio Quartulli Feb. 16, 2016, 3:01 p.m. UTC
  Hello David,

this pull request is intended for net.

Two of the fixes included in this patchset prevent a wrong memory
access - it was triggered when removing an object from a list
after it was already free'd due to bad reference counting.
This misbehaviour existed for both the gw_node and the
orig_node_vlan object and has been fixed by Sven Eckelmann.

The last patch fixes our interface feasibility check and prevents
it from looping indefinitely when two net_device objects
reference each other via iflink index (i.e. veth pair), by
Andrew Lunn


Please pull or let me know of any problem!
Thanks a lot,
	Antonio


The following changes since commit db92ea5d4df00271b57d79c2d03dae5a5d60fcc1:

  dscc4: Undefined signed int shift (2016-02-13 06:10:21 -0500)

are available in the git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to 1bc4e2b000e7fa9773d6623bc8850561ce10a4fb:

  batman-adv: Avoid endless loop in bat-on-bat netdevice check (2016-02-16 22:16:33 +0800)

----------------------------------------------------------------
Two of the fixes included in this patchset prevent wrong memory
access - it was triggered when removing an object from a list
after it was already free'd due to bad reference counting.
This misbehaviour existed for both the gw_node and the
orig_node_vlan object and has been fixed by Sven Eckelmann.

The last patch fixes our interface feasibility check and prevents
it from looping indefinitely when two net_device objects
reference each other via iflink index (i.e. veth pair), by
Andrew Lunn

----------------------------------------------------------------
Andrew Lunn (1):
      batman-adv: Avoid endless loop in bat-on-bat netdevice check

Sven Eckelmann (2):
      batman-adv: Only put gw_node list reference when removed
      batman-adv: Only put orig_node_vlan list reference when removed

 net/batman-adv/gateway_client.c    |  7 ++++---
 net/batman-adv/hard-interface.c    | 25 +++++++++++++++++++++++++
 net/batman-adv/translation-table.c |  6 ++++--
 3 files changed, 33 insertions(+), 5 deletions(-)
  

Comments

Antonio Quartulli Feb. 17, 2016, 4:20 a.m. UTC | #1
On Tue, Feb 16, 2016 at 11:01:25PM +0800, Antonio Quartulli wrote:
> Hello David,
> 
> this pull request is intended for net.

David,

when merging net into net-next these patches will create a conflict which git
should try to fix on its own.
However, it will still ask you to confirm something. Here are the relevant
chunks:

--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@@ -544,11 -527,12 +544,17 @@@ void batadv_gw_node_update(struct batad
                 * gets dereferenced.
                 */
                spin_lock_bh(&bat_priv->gw.list_lock);
-               hlist_del_init_rcu(&gw_node->list);
+               if (!hlist_unhashed(&gw_node->list)) {
+                       hlist_del_init_rcu(&gw_node->list);
+                       batadv_gw_node_free_ref(gw_node);
+               }
                spin_unlock_bh(&bat_priv->gw.list_lock);
  
++<<<<<<< HEAD
 +              batadv_gw_node_put(gw_node);
 +
++=======
++>>>>>>> maint



if you have this conflict, please keep the "maint" block.
Moreover, make sure that every reference to
batadv_gw_node_free_ref() in this file is substituted with
batadv_gw_node_put() (there should be only one).



diff --cc net/batman-adv/translation-table.c
index 2fd5b28,7301a92..0000000
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@@ -346,12 -311,14 +346,18 @@@ static void batadv_tt_global_size_mod(s
  
        if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
                spin_lock_bh(&orig_node->vlan_list_lock);
-               hlist_del_init_rcu(&vlan->list);
+               if (!hlist_unhashed(&vlan->list)) {
+                       hlist_del_init_rcu(&vlan->list);
+                       batadv_orig_node_vlan_free_ref(vlan);
+               }
                spin_unlock_bh(&orig_node->vlan_list_lock);
++<<<<<<< HEAD
 +              batadv_orig_node_vlan_put(vlan);
++=======
++>>>>>>> maint



if you have this conflict, please keep the "maint" block.
Moreover, make sure that every reference to
batadv_orig_node_vlan_free_ref() in this file is substituted with
batadv_orig_node_vlan_put() (there should be only one).



Obviously, I can check the final result after your merge operation.
Thanks!


Cheers,
  
David Miller Feb. 19, 2016, 8:37 p.m. UTC | #2
From: Antonio Quartulli <a@unstable.cc>
Date: Tue, 16 Feb 2016 23:01:25 +0800

> this pull request is intended for net.
> 
> Two of the fixes included in this patchset prevent a wrong memory
> access - it was triggered when removing an object from a list
> after it was already free'd due to bad reference counting.
> This misbehaviour existed for both the gw_node and the
> orig_node_vlan object and has been fixed by Sven Eckelmann.
> 
> The last patch fixes our interface feasibility check and prevents
> it from looping indefinitely when two net_device objects
> reference each other via iflink index (i.e. veth pair), by
> Andrew Lunn

Pulled, thanks Antonio.

And thanks for the heads up about the potential merge issues, I'll watch
for that.
  
Antonio Quartulli Feb. 20, 2016, 5:28 a.m. UTC | #3
On Fri, Feb 19, 2016 at 03:37:18PM -0500, David Miller wrote:
> And thanks for the heads up about the potential merge issues, I'll watch
> for that.
> 

Hi David,

actually I just realized that the patches that will create the conflict
are not yet in net-next, but they are still pending in my queue.

At this point I will wait for you to merge net into net-next first
(there should be no conflict at that point) and then I will rebase
my pending patches on top of that.


This should prevent you from dealing with any conflict.


Regards,
  
Antonio Quartulli Feb. 23, 2016, 5:07 a.m. UTC | #4
On Sat, Feb 20, 2016 at 01:28:40PM +0800, Antonio Quartulli wrote:
> On Fri, Feb 19, 2016 at 03:37:18PM -0500, David Miller wrote:
> > And thanks for the heads up about the potential merge issues, I'll watch
> > for that.
> > 
> 
> Hi David,
> 
> actually I just realized that the patches that will create the conflict
> are not yet in net-next, but they are still pending in my queue.
> 
> At this point I will wait for you to merge net into net-next first
> (there should be no conflict at that point) and then I will rebase
> my pending patches on top of that.
> 
> 
> This should prevent you from dealing with any conflict.

Hi David,

I know this kind of mails steal you some time, but do you have any plan
about merging net into net-next in the next days ?

I have some more new changes coming, but I'd like to send them only after
the merge operation is done to avoid you to deal with some conflicts (as per
above).

Thanks !
  
David Miller Feb. 23, 2016, 5:12 a.m. UTC | #5
From: Antonio Quartulli <a@unstable.cc>
Date: Tue, 23 Feb 2016 13:07:50 +0800

> I know this kind of mails steal you some time, but do you have any plan
> about merging net into net-next in the next days ?

It's what I'm working on right now.
  
David Miller Feb. 23, 2016, 5:36 a.m. UTC | #6
From: David Miller <davem@davemloft.net>
Date: Tue, 23 Feb 2016 00:12:35 -0500 (EST)

> From: Antonio Quartulli <a@unstable.cc>
> Date: Tue, 23 Feb 2016 13:07:50 +0800
> 
>> I know this kind of mails steal you some time, but do you have any plan
>> about merging net into net-next in the next days ?
> 
> It's what I'm working on right now.

And, done.