* [MPTCP][PATCH v4 mptcp-next] Squash to "mptcp: drop flags and ifindex arguments"
@ 2021-07-29 11:45 Geliang Tang
2021-07-30 18:14 ` Mat Martineau
0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2021-07-29 11:45 UTC (permalink / raw)
To: mptcp, geliangtang; +Cc: Geliang Tang
From: Geliang Tang <geliangtang@xiaomi.com>
Fix rcu section and add the non-zero id check.
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [MPTCP][PATCH v4 mptcp-next] Squash to "mptcp: drop flags and ifindex arguments"
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
0 siblings, 0 replies; 2+ messages in thread
From: Mat Martineau @ 2021-07-30 18:14 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp, Geliang Tang
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-30 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.