From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>,
andrew.gospodarek@broadcom.com, davem@davemloft.net,
edumazet@google.com, jgg@ziepe.ca, leon@kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
michael.chan@broadcom.com, netdev@vger.kernel.org,
pabeni@redhat.com, selvin.xavier@broadcom.com,
Leon Romanovsky <leonro@nvidia.com>
Subject: Re: [PATCH net-next v8 1/8] bnxt_en: Add auxiliary driver support
Date: Tue, 24 Jan 2023 07:42:51 +0100 [thread overview]
Message-ID: <Y89964YCQKwKlyB1@kroah.com> (raw)
In-Reply-To: <20230123223305.30c586ee@kernel.org>
On Mon, Jan 23, 2023 at 10:33:05PM -0800, Jakub Kicinski wrote:
> On Thu, 19 Jan 2023 22:05:28 -0800 Ajit Khaparde wrote:
> > @@ -13212,6 +13214,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)
> > kfree(bp->rss_indir_tbl);
> > bp->rss_indir_tbl = NULL;
> > bnxt_free_port_stats(bp);
> > + bnxt_aux_priv_free(bp);
> > free_netdev(dev);
>
> You're still freeing the memory in which struct device sits regardless
> of its reference count.
>
> Greg, is it legal to call:
>
> auxiliary_device_delete(adev); // AKA device_del(&auxdev->dev);
> auxiliary_device_uninit(adev); // AKA put_device(&auxdev->dev);
> free(adev); // frees struct device
Ick, the aux device release callback should be doing the freeing of the
memory, you shouldn't ever have to free it "manually" like this. To do
so would be a problem (i.e. the release callback would then free it
again, right?)
> ? I tried to explain this three times, maybe there's some wait during
> device_del() I'm not seeing which makes this safe :S
Nope, no intentional wait normally. You can add one by enabling a
debugging option to find all of the places where people are doing bad
things like this by delaying the freeing of the device memory until a
few seconds later, but that's generally not something you should run in
a production kernel as it finds all sorts of nasty bugs...
thanks,
greg k-h
next prev parent reply other threads:[~2023-01-24 6:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 6:05 [PATCH net-next v8 0/8] Add Auxiliary driver support Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 1/8] bnxt_en: Add auxiliary " Ajit Khaparde
2023-01-24 6:33 ` Jakub Kicinski
2023-01-24 6:42 ` Greg Kroah-Hartman [this message]
2023-01-24 7:07 ` Ajit Khaparde
2023-01-24 7:38 ` Greg Kroah-Hartman
2023-01-24 6:49 ` Leon Romanovsky
2023-01-24 7:08 ` Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 2/8] RDMA/bnxt_re: Use auxiliary driver interface Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 3/8] bnxt_en: Remove usage of ulp_id Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 4/8] bnxt_en: Use direct API instead of indirection Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 5/8] bnxt_en: Use auxiliary bus calls over proprietary calls Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 6/8] bnxt_en: Remove struct bnxt access from RoCE driver Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 7/8] RDMA/bnxt_re: Remove the sriov config callback Ajit Khaparde
2023-01-20 6:05 ` [PATCH net-next v8 8/8] bnxt_en: Remove runtime interrupt vector allocation Ajit Khaparde
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=Y89964YCQKwKlyB1@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=selvin.xavier@broadcom.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;
as well as URLs for NNTP newsgroup(s).