lkml.org 
[lkml]   [2020]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 72/95] mac80211: mesh: fix discovery timer re-arming issue / crash
Hi!

> From: Linus Lüssing <ll@simonwunderlich.de>
>
> commit e2d4a80f93fcfaf72e2e20daf6a28e39c3b90677 upstream.

> This patch fixes this issue by re-checking if mpath is about to be
> free'd and if so bails out of re-arming the timer.

> --- a/net/mac80211/mesh_hwmp.c
> +++ b/net/mac80211/mesh_hwmp.c
> @@ -1088,7 +1088,14 @@ void mesh_path_start_discovery(struct ie
> mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, ifmsh->sn,
> target_flags, mpath->dst, mpath->sn, da, 0,
> ttl, lifetime, 0, ifmsh->preq_id++, sdata);
> +
> + spin_lock_bh(&mpath->state_lock);
> + if (mpath->flags & MESH_PATH_DELETED) {
> + spin_unlock_bh(&mpath->state_lock);
> + goto enddiscovery;
> + }
> mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
> + spin_unlock_bh(&mpath->state_lock);
>
> enddiscovery:
> rcu_read_unlock();

This made brain freeze for a while. AFAICT it can be rewritten as:

+ spin_lock_bh(&mpath->state_lock);
+ if (!(mpath->flags & MESH_PATH_DELETED))
mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
+ spin_unlock_bh(&mpath->state_lock);

...?

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-06-01 23:11    [W:0.424 / U:1.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site