From: Jakub Kicinski <kuba@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
andrew+netdev@lunn.ch, netdev@vger.kernel.org,
Emil Tantilov <emil.s.tantilov@intel.com>,
david.m.ertman@intel.com, tatyana.e.nikolova@intel.com,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: Re: [PATCH net v2 2/5] ice: fix possible leak in ice_plug_aux_dev() error path
Date: Wed, 20 Aug 2025 18:45:14 -0700 [thread overview]
Message-ID: <20250820184514.0cf9cbb5@kernel.org> (raw)
In-Reply-To: <20250819222000.3504873-3-anthony.l.nguyen@intel.com>
On Tue, 19 Aug 2025 15:19:56 -0700 Tony Nguyen wrote:
> ret = auxiliary_device_init(adev);
> - if (ret) {
> - kfree(iadev);
> - return ret;
> - }
> + if (ret)
> + goto free_iadev;
>
> ret = auxiliary_device_add(adev);
> - if (ret) {
> - auxiliary_device_uninit(adev);
> - return ret;
I think the code is correct as is. Once auxiliary_device_init()
returns the device is refcounted, auxiliary_device_uninit()
will call release, which is ice_adev_release(), which in turn
frees iadev.
> - }
> + if (ret)
> + goto aux_dev_uninit;
>
> mutex_lock(&pf->adev_mutex);
> cdev->adev = adev;
> @@ -339,6 +335,13 @@ int ice_plug_aux_dev(struct ice_pf *pf)
> set_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags);
>
> return 0;
> +
> +aux_dev_uninit:
> + auxiliary_device_uninit(adev);
> +free_iadev:
> + kfree(iadev);
> +
> + return ret;
next prev parent reply other threads:[~2025-08-21 1:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 22:19 [PATCH net v2 0/5][pull request] Intel Wired LAN Driver Updates 2025-08-15 (ice, ixgbe, igc) Tony Nguyen
2025-08-19 22:19 ` [PATCH net v2 1/5] ice: fix NULL pointer dereference in ice_unplug_aux_dev() on reset Tony Nguyen
2025-08-19 22:19 ` [PATCH net v2 2/5] ice: fix possible leak in ice_plug_aux_dev() error path Tony Nguyen
2025-08-21 1:45 ` Jakub Kicinski [this message]
2025-08-21 8:46 ` Przemek Kitszel
2025-08-19 22:19 ` [PATCH net v2 3/5] ixgbe: xsk: resolve the negative overflow of budget in ixgbe_xmit_zc Tony Nguyen
2025-08-19 22:19 ` [PATCH net v2 4/5] ixgbe: fix ndo_xdp_xmit() workloads Tony Nguyen
2025-08-19 22:19 ` [PATCH net v2 5/5] igc: fix disabling L1.2 PCI-E link substate on I226 on init Tony Nguyen
2025-08-21 1:45 ` [PATCH net v2 0/5][pull request] Intel Wired LAN Driver Updates 2025-08-15 (ice, ixgbe, igc) Jakub Kicinski
2025-08-21 8:31 ` Przemek Kitszel
2025-08-21 14:22 ` Jakub Kicinski
2025-08-21 16:01 ` Tony Nguyen
2025-08-21 2:30 ` 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=20250820184514.0cf9cbb5@kernel.org \
--to=kuba@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=david.m.ertman@intel.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=tatyana.e.nikolova@intel.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 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.