public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Assmann <sassmann@redhat.com>
To: "Keller, Jacob E" <jacob.e.keller@intel.com>
Cc: "Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Brelinski, Tony" <tony.brelinski@intel.com>
Subject: Re: [PATCH net 06/10] iavf: prevent accidental free of filter structure
Date: Wed, 17 Nov 2021 07:37:08 +0100	[thread overview]
Message-ID: <20211117063708.ekrxtv7e6jn5thvp@p1> (raw)
In-Reply-To: <a7adb8a7-800e-6761-b791-e877ff79210a@intel.com>

On 2021-11-16 20:18, Keller, Jacob E wrote:
> On 11/15/2021 11:24 PM, Stefan Assmann wrote:
> > On 2021-11-15 15:59, Tony Nguyen wrote:
> >> From: Jacob Keller <jacob.e.keller@intel.com>
> >>
> >> In iavf_config_clsflower, the filter structure could be accidentally
> >> released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever
> >> return a non-zero but positive value.
> >>
> >> In this case, the function continues through to the end, and will call
> >> kfree() on the filter structure even though it has been added to the
> >> linked list.
> >>
> >> This can actually happen because iavf_parse_cls_flower will return
> >> a positive IAVF_ERR_CONFIG value instead of the traditional negative
> >> error codes.
> > 
> > Hi Jacob,
> > 
> > where exactly does this happen?
> > Looking at iavf_parse_cls_flower() I see all returns of IAVF_ERR_CONFIG
> > as "return IAVF_ERR_CONFIG;" while IAVF_ERR_CONFIG is defined as
> >         IAVF_ERR_CONFIG                         = -4,
> > 
> > I'm not opposed to this change, just wondering what's going on.
> > 
> >   Stefan
> > 
> 
> Heh.
> 
> I don't have memory of the full context for the original work. We've
> been going through and trying to pull in fixes that we've done for our
> out-of-tree driver and get everything upstream.
> 
> At first I thought this might be because of some history where these
> values used to be positive in the out-of-tree history at some point...
> But I think this wasn't true. It is possible that some other flow
> accidentally sends a positive value, but I've long since lost memory of
> if I had an example of that. You're correct that IAVF_ERR_CONFIG is (and
> has been in both upstream and out-of-tree code since its inception)
> negative.
> 
> I don't think this change is harmful, but I think you're right in
> pointing out the description isn't really valid.
> 
> I'm happy to re-write this commit message for clarity.
> 
> I do think switching to "if (err)" is more idiomatic and the correct
> thing to do.

Great feedback thanks, I totally agree.

  Stefan


  reply	other threads:[~2021-11-17  6:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 23:59 [PATCH net 00/10][pull request] Intel Wired LAN Driver Updates 2021-11-15 Tony Nguyen
2021-11-15 23:59 ` [PATCH net 01/10] iavf: Fix return of set the new channel count Tony Nguyen
2021-11-16  7:07   ` Stefan Assmann
2021-11-15 23:59 ` [PATCH net 02/10] iavf: check for null in iavf_fix_features Tony Nguyen
2021-11-15 23:59 ` [PATCH net 03/10] iavf: free q_vectors before queues in iavf_disable_vf Tony Nguyen
2021-11-15 23:59 ` [PATCH net 04/10] iavf: don't clear a lock we don't hold Tony Nguyen
2021-11-15 23:59 ` [PATCH net 05/10] iavf: Fix failure to exit out from last all-multicast mode Tony Nguyen
2021-11-15 23:59 ` [PATCH net 06/10] iavf: prevent accidental free of filter structure Tony Nguyen
2021-11-16  7:24   ` Stefan Assmann
2021-11-16 20:18     ` Keller, Jacob E
2021-11-17  6:37       ` Stefan Assmann [this message]
2021-11-15 23:59 ` [PATCH net 07/10] iavf: validate pointers Tony Nguyen
2021-11-15 23:59 ` [PATCH net 08/10] iavf: Fix for the false positive ASQ/ARQ errors while issuing VF reset Tony Nguyen
2021-11-15 23:59 ` [PATCH net 09/10] iavf: Fix for setting queues to 0 Tony Nguyen
2021-11-15 23:59 ` [PATCH net 10/10] iavf: Restore VLAN filters after link down Tony Nguyen
2021-11-16 13:40 ` [PATCH net 00/10][pull request] Intel Wired LAN Driver Updates 2021-11-15 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=20211117063708.ekrxtv7e6jn5thvp@p1 \
    --to=sassmann@redhat.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tony.brelinski@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox