MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliangtang@gmail.com>
Cc: mptcp@lists.linux.dev, Geliang Tang <geliangtang@xiaomi.com>
Subject: Re: [MPTCP][PATCH v4 mptcp-next] Squash to "mptcp: drop flags and ifindex arguments"
Date: Fri, 30 Jul 2021 11:14:37 -0700 (PDT)	[thread overview]
Message-ID: <ca6c9e81-d273-207e-9449-b34ef6a8db39@linux.intel.com> (raw)
In-Reply-To: <7353b0ca7f73188dbbb24b9e1fcb0fd4620a8d25.1627559076.git.geliangtang@xiaomi.com>

On Thu, 29 Jul 2021, Geliang Tang wrote:

> From: Geliang Tang <geliangtang@xiaomi.com>
>
> Fix rcu section and add the non-zero id check.
>

Looks good to squash, thanks.

-Mat


> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
> net/mptcp/pm_netlink.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 94c68d6093de..47200ae451b9 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1107,16 +1107,17 @@ int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id,
> {
> 	struct mptcp_pm_addr_entry *entry;
>
> -	rcu_read_lock();
> -	entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id);
> -	rcu_read_unlock();
> -
> -	if (entry) {
> -		*flags = entry->flags;
> -		*ifindex = entry->ifindex;
> -	} else {
> -		*flags = 0;
> -		*ifindex = 0;
> +	*flags = 0;
> +	*ifindex = 0;
> +
> +	if (id) {
> +		rcu_read_lock();
> +		entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id);
> +		if (entry) {
> +			*flags = entry->flags;
> +			*ifindex = entry->ifindex;
> +		}
> +		rcu_read_unlock();
> 	}
>
> 	return 0;
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

      reply	other threads:[~2021-07-30 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 11:45 [MPTCP][PATCH v4 mptcp-next] Squash to "mptcp: drop flags and ifindex arguments" Geliang Tang
2021-07-30 18:14 ` Mat Martineau [this message]

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=ca6c9e81-d273-207e-9449-b34ef6a8db39@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=geliangtang@gmail.com \
    --cc=geliangtang@xiaomi.com \
    --cc=mptcp@lists.linux.dev \
    /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