From: Matthieu Baerts <matttbe@kernel.org>
To: Yue Haibing <yuehaibing@huawei.com>, pabeni@redhat.com, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
horms@kernel.org, ap420073@gmail.com,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH net] ipv6: mcast: Delay put pmc->idev in mld_del_delrec(): manual merge
Date: Thu, 17 Jul 2025 16:41:42 +0200 [thread overview]
Message-ID: <8cc52891-3653-4b03-a45e-05464fe495cf@kernel.org> (raw)
In-Reply-To: <20250714141957.3301871-1-yuehaibing@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
Hi Yue, Paolo, Jakub,
On 14/07/2025 16:19, Yue Haibing wrote:
> pmc->idev is still used in ip6_mc_clear_src(), so as mld_clear_delrec()
> does, the reference should be put after ip6_mc_clear_src() return.
FYI, I got a small conflict when merging 'net' in 'net-next' in the
MPTCP tree due to this patch applied in 'net':
ae3264a25a46 ("ipv6: mcast: Delay put pmc->idev in mld_del_delrec()")
and this one from 'net-next':
a8594c956cc9 ("ipv6: mcast: Avoid a duplicate pointer check in
mld_del_delrec()")
----- Generic Message -----
The best is to avoid conflicts between 'net' and 'net-next' trees but if
they cannot be avoided when preparing patches, a note about how to fix
them is much appreciated.
The conflict has been resolved on our side[1] and the resolution we
suggest is attached to this email. Please report any issues linked to
this conflict resolution as it might be used by others. If you worked on
the mentioned patches, don't hesitate to ACK this conflict resolution.
---------------------------
Regarding this conflict, the patch from net has been applied at a
slightly different place after the code refactoring from net-next.
Rerere cache is available in [2].
[1] https://github.com/multipath-tcp/mptcp_net-next/commit/ec9d9e40de20
[2] https://github.com/multipath-tcp/mptcp-upstream-rr-cache/commit/fe71
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
[-- Attachment #2: ec9d9e40de2017c816864c2193a8a255ddd32815.patch --]
[-- Type: text/x-patch, Size: 2059 bytes --]
diff --cc net/ipv6/mcast.c
index 0c63c33ab080,616bf4c0c8fd..36ca27496b3c
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@@ -786,34 -783,37 +786,34 @@@ static void mld_del_delrec(struct inet6
break;
pmc_prev = pmc;
}
- if (pmc) {
- if (pmc_prev)
- rcu_assign_pointer(pmc_prev->next, pmc->next);
- else
- rcu_assign_pointer(idev->mc_tomb, pmc->next);
- }
+ if (!pmc)
+ return;
+ if (pmc_prev)
+ rcu_assign_pointer(pmc_prev->next, pmc->next);
+ else
+ rcu_assign_pointer(idev->mc_tomb, pmc->next);
- if (pmc) {
- im->idev = pmc->idev;
- if (im->mca_sfmode == MCAST_INCLUDE) {
- tomb = rcu_replace_pointer(im->mca_tomb,
- mc_dereference(pmc->mca_tomb, pmc->idev),
- lockdep_is_held(&im->idev->mc_lock));
- rcu_assign_pointer(pmc->mca_tomb, tomb);
+ im->idev = pmc->idev;
+ if (im->mca_sfmode == MCAST_INCLUDE) {
+ tomb = rcu_replace_pointer(im->mca_tomb,
+ mc_dereference(pmc->mca_tomb, pmc->idev),
+ lockdep_is_held(&im->idev->mc_lock));
+ rcu_assign_pointer(pmc->mca_tomb, tomb);
- sources = rcu_replace_pointer(im->mca_sources,
- mc_dereference(pmc->mca_sources, pmc->idev),
- lockdep_is_held(&im->idev->mc_lock));
- rcu_assign_pointer(pmc->mca_sources, sources);
- for_each_psf_mclock(im, psf)
- psf->sf_crcount = idev->mc_qrv;
- } else {
- im->mca_crcount = idev->mc_qrv;
- }
- ip6_mc_clear_src(pmc);
- in6_dev_put(pmc->idev);
- kfree_rcu(pmc, rcu);
+ sources = rcu_replace_pointer(im->mca_sources,
+ mc_dereference(pmc->mca_sources, pmc->idev),
+ lockdep_is_held(&im->idev->mc_lock));
+ rcu_assign_pointer(pmc->mca_sources, sources);
+ for_each_psf_mclock(im, psf)
+ psf->sf_crcount = idev->mc_qrv;
+ } else {
+ im->mca_crcount = idev->mc_qrv;
}
- in6_dev_put(pmc->idev);
+ ip6_mc_clear_src(pmc);
++ in6_dev_put(pmc->idev);
+ kfree_rcu(pmc, rcu);
}
-/* called with mc_lock */
static void mld_clear_delrec(struct inet6_dev *idev)
{
struct ifmcaddr6 *pmc, *nextpmc;
next prev parent reply other threads:[~2025-07-17 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 14:19 [PATCH net] ipv6: mcast: Delay put pmc->idev in mld_del_delrec() Yue Haibing
2025-07-17 1:40 ` patchwork-bot+netdevbpf
2025-07-17 14:41 ` Matthieu Baerts [this message]
2025-07-18 1:33 ` [PATCH net] ipv6: mcast: Delay put pmc->idev in mld_del_delrec(): manual merge Yue Haibing
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=8cc52891-3653-4b03-a45e-05464fe495cf@kernel.org \
--to=matttbe@kernel.org \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sfr@canb.auug.org.au \
--cc=yuehaibing@huawei.com \
/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
all inboxes | Powered by JetHome®