From: Simon Horman <horms@kernel.org>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: kuba@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, saikrishnag@marvell.com,
sbhatta@marvell.com, sgoutham@marvell.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com
Subject: Re: [PATCH v2 net] octeontx2-af: fix cn20k mailbox lifetime on repeated rvu_mbox_init()
Date: Mon, 24 Aug 2026 14:39:20 +0100 [thread overview]
Message-ID: <20260824133920.GV265046@horms.kernel.org> (raw)
In-Reply-To: <20260821102337.2989169-1-rkannoth@marvell.com>
On Fri, Aug 21, 2026 at 03:53:37PM +0530, Ratheesh Kannoth wrote:
> From: Sai Krishna <saikrishnag@marvell.com>
>
> rvu_mbox_init() is called separately for AF-PF mailboxes during probe
> and for AF-VF mailboxes when SR-IOV is enabled. Each call used to
> allocate a new ng_rvu object, leaking the first allocation when the
> pointer was overwritten on the second call.
>
> Sharing one ng_rvu across both paths exposed several teardown bugs:
> the error path freed all cn20k mailbox DMA and kfree()d ng_rvu even
> when only the failing init type should be unwound, leaving live AF-PF
> mailbox memory in use after an AF-VF init failure. mutex_init() was
> also re-run on the AF-VF path while AF-PF mailbox handlers could still
> hold rvu->mbox_lock. Probe and SR-IOV failure paths did not release
> cn20k mailbox DMA either, since cleanup only happened in rvu_remove().
>
> Allocate ng_rvu once with devm_kzalloc(), initialize mbox_lock in the
> same block, unwind only the mailbox memory for the failing init type,
> and free cn20k mailbox DMA from the probe and pci_enable_sriov()
> error paths.
>
> Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
>
> ---
> v1 -> v2: Addressed sashiko comments
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260820053656.2614614-1-rkannoth%40marvell.com
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-08-24 13:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:23 Ratheesh Kannoth
2026-08-24 13:39 ` Simon Horman [this message]
2026-08-24 19:20 ` patchwork-bot+netdevbpf
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=20260824133920.GV265046@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=saikrishnag@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.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®