From: Simon Horman <horms@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Gui-Dong Han <hanguidong02@outlook.com>,
Jia-Ju Bai <baijiaju1990@gmail.com>,
intel-wired-lan@lists.osuosl.org,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH v2] ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count()
Date: Sat, 7 Sep 2024 14:52:03 +0100 [thread overview]
Message-ID: <20240907135203.GQ2097826@kernel.org> (raw)
In-Reply-To: <99a2d643-9004-41c8-8585-6c5c86fab599@web.de>
On Sat, Sep 07, 2024 at 02:40:10PM +0200, Markus Elfring wrote:
> …
> > +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
> > @@ -1096,8 +1096,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
> > return -ENOENT;
> >
> > vsi = ice_get_vf_vsi(vf);
> > - if (!vsi)
> > + if (!vsi) {
> > + ice_put_vf(vf);
> > return -ENOENT;
> > + }
> >
> > prev_msix = vf->num_msix;
> > prev_queues = vf->num_vf_qs;
> > @@ -1142,8 +1144,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
> > vf->num_msix = prev_msix;
> > vf->num_vf_qs = prev_queues;
> > vf->first_vector_idx = ice_sriov_get_irqs(pf, vf->num_msix);
> > - if (vf->first_vector_idx < 0)
> > + if (vf->first_vector_idx < 0) {
> > + ice_put_vf(vf);
> > return -EINVAL;
> > + }
> >
> > if (needs_rebuild) {
> > ice_vf_reconfig_vsi(vf);
>
> Would you like to collaborate with any goto chains according to
> the desired completion of exception handling?
Yes, I agree that might be nice. But the changes made by this patch are
consistent with the exiting error handling in this function. And as a fix,
this minimal approach seems appropriate to me. IOW, I believe clean-up
should be separated from fixes in this case.
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Gui-Dong Han <hanguidong02@outlook.com>,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: Re: [PATCH v2] ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count()
Date: Sat, 7 Sep 2024 14:52:03 +0100 [thread overview]
Message-ID: <20240907135203.GQ2097826@kernel.org> (raw)
In-Reply-To: <99a2d643-9004-41c8-8585-6c5c86fab599@web.de>
On Sat, Sep 07, 2024 at 02:40:10PM +0200, Markus Elfring wrote:
> …
> > +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
> > @@ -1096,8 +1096,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
> > return -ENOENT;
> >
> > vsi = ice_get_vf_vsi(vf);
> > - if (!vsi)
> > + if (!vsi) {
> > + ice_put_vf(vf);
> > return -ENOENT;
> > + }
> >
> > prev_msix = vf->num_msix;
> > prev_queues = vf->num_vf_qs;
> > @@ -1142,8 +1144,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
> > vf->num_msix = prev_msix;
> > vf->num_vf_qs = prev_queues;
> > vf->first_vector_idx = ice_sriov_get_irqs(pf, vf->num_msix);
> > - if (vf->first_vector_idx < 0)
> > + if (vf->first_vector_idx < 0) {
> > + ice_put_vf(vf);
> > return -EINVAL;
> > + }
> >
> > if (needs_rebuild) {
> > ice_vf_reconfig_vsi(vf);
>
> Would you like to collaborate with any goto chains according to
> the desired completion of exception handling?
Yes, I agree that might be nice. But the changes made by this patch are
consistent with the exiting error handling in this function. And as a fix,
this minimal approach seems appropriate to me. IOW, I believe clean-up
should be separated from fixes in this case.
next prev parent reply other threads:[~2024-09-07 13:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 11:59 [Intel-wired-lan] [PATCH v2] ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count() Gui-Dong Han
2024-09-03 11:59 ` Gui-Dong Han
2024-09-06 8:30 ` [Intel-wired-lan] " Simon Horman
2024-09-06 8:30 ` Simon Horman
2024-09-07 12:40 ` [Intel-wired-lan] " Markus Elfring
2024-09-07 12:40 ` Markus Elfring
2024-09-07 13:52 ` Simon Horman [this message]
2024-09-07 13:52 ` Simon Horman
2024-09-07 14:13 ` [Intel-wired-lan] " Greg KH
2024-09-07 14:13 ` Greg KH
2024-09-09 14:16 ` [Intel-wired-lan] " Romanowski, Rafal
2024-09-09 14:16 ` Romanowski, Rafal
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=20240907135203.GQ2097826@kernel.org \
--to=horms@kernel.org \
--cc=Markus.Elfring@web.de \
--cc=anthony.l.nguyen@intel.com \
--cc=baijiaju1990@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hanguidong02@outlook.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=stable@vger.kernel.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: 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.