o11s / open80211s

open80211s
Other
242 stars 55 forks source link

IMHO, Will it be a problem that hwmp_perr_frame_process function has no rcu_read_unlock()? #68

Closed e1001925 closed 6 years ago

e1001925 commented 6 years ago

_rcu_readlock(); mpath = mesh_path_lookup(sdata, target_addr); if (mpath) { struct sta_info *sta; spin_lock_bh(&mpath->state_lock);

    sta = next_hop_deref_protected(mpath);
    if (mpath->flags & MESH_PATH_ACTIVE &&
        ether_addr_equal(ta, sta->sta.addr) &&
        (!(mpath->flags & MESH_PATH_SN_VALID) ||
        SN_GT(target_sn, mpath->sn))) {
        mpath->flags &= ~MESH_PATH_ACTIVE;
        mpath->sn = target_sn;
        spin_unlock_bh(&mpath->state_lock);
        if (!ifmsh->mshcfg.dot11MeshForwarding)
            goto endperr;
        mesh_path_error_tx(sdata, ttl, target_addr,
                   cpu_to_le32(target_sn),
                   cpu_to_le16(target_rcode),
                   broadcast_addr);
    } else
        spin_unlock_bh(&mpath->state_lock);
}

endperr: _rcu_readunlock(); }

bcopeland commented 6 years ago

If not goto endperr it will still be executed (there is no return before that point).

On Mon, Oct 30, 2017 at 12:50:51AM -0700, Michael65535 wrote:

_rcu_readlock(); mpath = mesh_path_lookup(sdata, target_addr); if (mpath) { struct sta_info *sta;

  spin_lock_bh(&mpath->state_lock);
  sta = next_hop_deref_protected(mpath);
  if (mpath->flags & MESH_PATH_ACTIVE &&
      ether_addr_equal(ta, sta->sta.addr) &&
      (!(mpath->flags & MESH_PATH_SN_VALID) ||
      SN_GT(target_sn, mpath->sn))) {
      mpath->flags &= ~MESH_PATH_ACTIVE;
      mpath->sn = target_sn;
      spin_unlock_bh(&mpath->state_lock);
      if (!ifmsh->mshcfg.dot11MeshForwarding)
          goto endperr;
      mesh_path_error_tx(sdata, ttl, target_addr,
                 cpu_to_le32(target_sn),
                 cpu_to_le16(target_rcode),
                 broadcast_addr);
  } else
      spin_unlock_bh(&mpath->state_lock);

} endperr: _rcu_readunlock(); }

What if not goto endperr

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/o11s/open80211s/issues/68

-- Bob Copeland %% https://bobcopeland.com/