netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Kees Cook <keescook@chromium.org>, linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] net/mac80211/mesh_plink: Convert timers to use
Date: Thu, 05 Oct 2017 08:47:32 +0200	[thread overview]
Message-ID: <1507186052.2387.11.camel@sipsolutions.net> (raw)
In-Reply-To: <20171005004952.GA23133@beast> (sfid-20171005_024956_516988_77418294)

On Wed, 2017-10-04 at 17:49 -0700, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list
> pointer to all timer callbacks, switch to using the new timer_setup()
> and from_timer() to pass the timer pointer explicitly. This requires
> adding a pointer back to the sta_info since container_of() can't
> resolve the sta_info.

The subject seems to be lacking something ... :-)

> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.

I still can't apply that because that's not in net-next right now.

>  static inline void mesh_plink_timer_set(struct sta_info *sta, u32
> timeout)
>  {
>  	sta->mesh->plink_timer.expires = jiffies +
> msecs_to_jiffies(timeout);
> -	sta->mesh->plink_timer.data = (unsigned long) sta;
> -	sta->mesh->plink_timer.function = mesh_plink_timer;
> +	sta->mesh->plink_sta = sta;
> +	sta->mesh->plink_timer.function =
> (TIMER_FUNC_TYPE)mesh_plink_timer;
>  	sta->mesh->plink_timeout = timeout;
>  	add_timer(&sta->mesh->plink_timer);

Wouldn't it be better to convert this to timer_setup() now?

That add_timer() should probably also be mod_timer() anyway?

> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index 69615016d5bf..5e5de9455e4e 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -332,7 +332,7 @@ struct sta_info *sta_info_alloc(struct
> ieee80211_sub_if_data *sdata,
>  		spin_lock_init(&sta->mesh->plink_lock);
>  		if (ieee80211_vif_is_mesh(&sdata->vif) &&
>  		    !sdata->u.mesh.user_mpm)
> -			init_timer(&sta->mesh->plink_timer);
> +			timer_setup(&sta->mesh->plink_timer, NULL,
> 0);
>  		sta->mesh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
>  	}

You just have to make mesh_plink_timer() non-static, put a prototype
into mesh.h and then you can use the proper timer_setup() here with the
function?

Also, the sta->mesh->plink_sta assignment should be here I'd say, no
point rewriting it all the time.

I guess you were shooting for minimal, and I suppose we can do the
cleanups later too ...

johannes

  reply	other threads:[~2017-10-05  6:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  0:49 [PATCH] net/mac80211/mesh_plink: Convert timers to use Kees Cook
2017-10-05  6:47 ` Johannes Berg [this message]
2017-10-05 17:27   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507186052.2387.11.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).