netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	David Miller <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org, j@w1.fi,
	tgraf@suug.ch
Subject: Re: [PATCH 2/4] mac80211: Free mpath object when rhashtable insertion fails
Date: Wed, 13 Feb 2019 16:04:29 +0100	[thread overview]
Message-ID: <36adaef5c982ba10444d6f837b0d5c55ac953bdf.camel@sipsolutions.net> (raw)
In-Reply-To: <E1gtvgu-0006bT-4G@gondobar>

On Wed, 2019-02-13 at 22:39 +0800, Herbert Xu wrote:
> +	if (ret != -EEXIST)
>  		return ERR_PTR(ret);

Surely that should still be "if (ret && ret != -EEXIST)" otherwise you
return for the success case too? or "else if"?

I'd probably say we should combine all those ifs into something like this?


if (ret == 0) {
	sdata->u.mesh.mesh_paths_generation++;
	return new_mpath;
} else if (ret == -EEXIST) {
	kfree(new_mpath);
	return mpath;
} else {
	kfree(new_mpath);
	return NULL;
}


Yes, that's a small change in behaviour as to when the generation
counter is updated, but I'm pretty sure it really only needs updating
when we inserted something, not if we found an old mpath.

johannes


  reply	other threads:[~2019-02-13 15:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  5:05 [PATCH 0/2] mac80211: Fix incorrect usage of rhashtable walk API Herbert Xu
2019-02-13  5:16 ` [PATCH 1/2] mac80211: Use linked list instead of rhashtable walk for mesh tables Herbert Xu
2019-02-13 13:47   ` Herbert Xu
2019-02-13  5:16 ` [PATCH 2/2] mac80211: Free mpath object when rhashtable insertion fails Herbert Xu
2019-02-14  5:52   ` Dan Carpenter
2019-02-13  5:25 ` [PATCH] mac80211: Use rhashtable_lookup_get_insert_fast instead of racy code Herbert Xu
2019-02-13  5:34 ` [PATCH] rhashtable: Remove obsolete rhashtable_walk_init function Herbert Xu
     [not found]   ` <201902131934.29Pw8ywP%fengguang.wu@intel.com>
2019-02-13 13:41     ` Herbert Xu
2019-02-13 14:38 ` [v2 PATCH 0/4] mac80211: Fix incorrect usage of rhashtable walk API Herbert Xu
2019-02-13 14:39   ` [PATCH 1/4] mac80211: Use linked list instead of rhashtable walk for mesh tables Herbert Xu
2019-02-13 14:39   ` [PATCH 2/4] mac80211: Free mpath object when rhashtable insertion fails Herbert Xu
2019-02-13 15:04     ` Johannes Berg [this message]
2019-02-14  9:41       ` Herbert Xu
2019-02-14 14:04       ` Herbert Xu
2019-02-13 14:39   ` [PATCH 3/4] mac80211: Use rhashtable_lookup_get_insert_fast instead of racy code Herbert Xu
2019-02-13 14:39   ` [PATCH 4/4] rhashtable: Remove obsolete rhashtable_walk_init function Herbert Xu
2019-02-13 14:55   ` [v2 PATCH 0/4] mac80211: Fix incorrect usage of rhashtable walk API Johannes Berg
2019-02-14 14:02   ` [v3 " Herbert Xu
2019-02-14 14:03     ` [PATCH 1/4] mac80211: Use linked list instead of rhashtable walk for mesh tables Herbert Xu
2019-02-14 14:03     ` [PATCH 2/4] mac80211: Free mpath object when rhashtable insertion fails Herbert Xu
2019-02-14 14:03     ` [PATCH 3/4] mac80211: Use rhashtable_lookup_get_insert_fast instead of racy code Herbert Xu
2019-02-14 14:03     ` [PATCH 4/4] rhashtable: Remove obsolete rhashtable_walk_init function Herbert Xu
2019-02-15 12:21     ` [v3 PATCH 0/4] mac80211: Fix incorrect usage of rhashtable walk API Johannes Berg
2019-02-18 10:25       ` Herbert Xu

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=36adaef5c982ba10444d6f837b0d5c55ac953bdf.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=j@w1.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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).