From: Kuniyuki Iwashima <kuniyu@amazon.com> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, David Ahern <dsahern@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@mandriva.com>, Joanne Koong <joannelkoong@gmail.com>, Martin KaFai Lau <martin.lau@kernel.org>, "Mat Martineau" <mathew.j.martineau@linux.intel.com>, "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>, Stephen Hemminger <stephen@networkplumber.org>, Pengfei Xu <pengfei.xu@intel.com>, "Kuniyuki Iwashima" <kuniyu@amazon.com>, Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>, <dccp@vger.kernel.org> Subject: [PATCH v2 net 2/4] dccp/tcp: Remove NULL check for prev_saddr in inet_bhash2_update_saddr(). Date: Wed, 16 Nov 2022 14:28:03 -0800 [thread overview] Message-ID: <20221116222805.64734-3-kuniyu@amazon.com> (raw) In-Reply-To: <20221116222805.64734-1-kuniyu@amazon.com> When we call inet_bhash2_update_saddr(), prev_saddr is always non-NULL. Let's remove the unnecessary test. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> --- net/ipv4/inet_hashtables.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 033bf3c2538f..d745f962745e 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -877,13 +877,10 @@ int inet_bhash2_update_saddr(struct inet_bind_hashbucket *prev_saddr, struct soc head2 = inet_bhashfn_portaddr(hinfo, sk, net, port); - if (prev_saddr) { - spin_lock_bh(&prev_saddr->lock); - __sk_del_bind2_node(sk); - inet_bind2_bucket_destroy(hinfo->bind2_bucket_cachep, - inet_csk(sk)->icsk_bind2_hash); - spin_unlock_bh(&prev_saddr->lock); - } + spin_lock_bh(&prev_saddr->lock); + __sk_del_bind2_node(sk); + inet_bind2_bucket_destroy(hinfo->bind2_bucket_cachep, inet_csk(sk)->icsk_bind2_hash); + spin_unlock_bh(&prev_saddr->lock); spin_lock_bh(&head2->lock); tb2 = inet_bind2_bucket_find(head2, net, port, l3mdev, sk); -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Kuniyuki Iwashima <kuniyu@amazon.com> To: dccp@vger.kernel.org Subject: [PATCH v2 net 2/4] dccp/tcp: Remove NULL check for prev_saddr in inet_bhash2_update_saddr(). Date: Wed, 16 Nov 2022 22:28:03 +0000 [thread overview] Message-ID: <20221116222805.64734-3-kuniyu@amazon.com> (raw) When we call inet_bhash2_update_saddr(), prev_saddr is always non-NULL. Let's remove the unnecessary test. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> --- net/ipv4/inet_hashtables.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 033bf3c2538f..d745f962745e 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -877,13 +877,10 @@ int inet_bhash2_update_saddr(struct inet_bind_hashbucket *prev_saddr, struct soc head2 = inet_bhashfn_portaddr(hinfo, sk, net, port); - if (prev_saddr) { - spin_lock_bh(&prev_saddr->lock); - __sk_del_bind2_node(sk); - inet_bind2_bucket_destroy(hinfo->bind2_bucket_cachep, - inet_csk(sk)->icsk_bind2_hash); - spin_unlock_bh(&prev_saddr->lock); - } + spin_lock_bh(&prev_saddr->lock); + __sk_del_bind2_node(sk); + inet_bind2_bucket_destroy(hinfo->bind2_bucket_cachep, inet_csk(sk)->icsk_bind2_hash); + spin_unlock_bh(&prev_saddr->lock); spin_lock_bh(&head2->lock); tb2 = inet_bind2_bucket_find(head2, net, port, l3mdev, sk); -- 2.30.2
next prev parent reply other threads:[~2022-11-16 22:29 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-16 22:28 [PATCH v2 net 0/4] dccp/tcp: Fix bhash2 issues related to WARN_ON() in inet_csk_get_port() Kuniyuki Iwashima 2022-11-16 22:28 ` Kuniyuki Iwashima 2022-11-16 22:28 ` [PATCH v2 net 1/4] dccp/tcp: Reset saddr on failure after inet6?_hash_connect() Kuniyuki Iwashima 2022-11-16 22:28 ` Kuniyuki Iwashima 2022-11-17 0:11 ` Joanne Koong 2022-11-17 0:11 ` Joanne Koong 2022-11-17 0:20 ` Kuniyuki Iwashima 2022-11-17 0:20 ` Kuniyuki Iwashima 2022-11-17 0:43 ` Joanne Koong 2022-11-17 0:43 ` Joanne Koong 2022-11-16 22:28 ` Kuniyuki Iwashima [this message] 2022-11-16 22:28 ` [PATCH v2 net 2/4] dccp/tcp: Remove NULL check for prev_saddr in inet_bhash2_update_saddr() Kuniyuki Iwashima 2022-11-17 0:07 ` Joanne Koong 2022-11-17 0:07 ` Joanne Koong 2022-11-16 22:28 ` [PATCH v2 net 3/4] dccp/tcp: Don't update saddr before unlinking sk from the old bucket Kuniyuki Iwashima 2022-11-16 22:28 ` Kuniyuki Iwashima 2022-11-17 21:32 ` Joanne Koong 2022-11-17 21:32 ` Joanne Koong 2022-11-17 23:59 ` Kuniyuki Iwashima 2022-11-18 0:06 ` Kuniyuki Iwashima 2022-11-18 0:55 ` Joanne Koong 2022-11-18 0:55 ` Joanne Koong 2022-11-18 1:08 ` Kuniyuki Iwashima 2022-11-18 1:08 ` Kuniyuki Iwashima 2022-11-18 18:56 ` Joanne Koong 2022-11-18 19:02 ` Joanne Koong 2022-11-18 19:58 ` Kuniyuki Iwashima 2022-11-18 19:58 ` Kuniyuki Iwashima 2022-11-16 22:28 ` [PATCH v2 net 4/4] dccp/tcp: Fixup bhash2 bucket when connect() fails Kuniyuki Iwashima 2022-11-16 22:28 ` Kuniyuki Iwashima 2022-11-17 2:23 ` Pengfei Xu 2022-11-17 2:23 ` Pengfei Xu 2022-11-17 3:20 ` Kuniyuki Iwashima 2022-11-17 3:20 ` Kuniyuki Iwashima 2022-11-17 4:56 ` Pengfei Xu 2022-11-17 5:02 ` Pengfei 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=20221116222805.64734-3-kuniyu@amazon.com \ --to=kuniyu@amazon.com \ --cc=acme@mandriva.com \ --cc=davem@davemloft.net \ --cc=dccp@vger.kernel.org \ --cc=dsahern@kernel.org \ --cc=edumazet@google.com \ --cc=joannelkoong@gmail.com \ --cc=kuba@kernel.org \ --cc=kuni1840@gmail.com \ --cc=martin.lau@kernel.org \ --cc=mathew.j.martineau@linux.intel.com \ --cc=netdev@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=pengfei.xu@intel.com \ --cc=stephen@networkplumber.org \ --cc=william.xuanziyang@huawei.com \ --cc=yoshfuji@linux-ipv6.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.