From: Simon Horman <simon.horman@corigine.com>
To: Fedor Pchelkin <pchelkin@ispras.ru>
Cc: Pravin B Shelar <pshelar@ovn.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eelco Chaudron <echaudro@redhat.com>,
netdev@vger.kernel.org, dev@openvswitch.org,
linux-kernel@vger.kernel.org,
Alexey Khoroshilov <khoroshilov@ispras.ru>,
lvc-project@linuxtesting.org
Subject: Re: [PATCH] net: openvswitch: fix flow memory leak in ovs_flow_cmd_new
Date: Wed, 1 Feb 2023 17:54:28 +0100 [thread overview]
Message-ID: <Y9qZRCn7CLhYr5h3@corigine.com> (raw)
In-Reply-To: <a0be13d0-22d5-b92b-9fed-4faeed30fdce@ispras.ru>
On Wed, Feb 01, 2023 at 07:28:09PM +0300, Fedor Pchelkin wrote:
> On 2/1/23 6:45 PM, Simon Horman wrote:
> > I see this would work by virtue of kfree(key) doing nothing
> > of key is NULL, the error case in question. And that otherwise key is
> > non-NULL if this path is hit.
> >
> > However, the idiomatic approach to error handling is for the error path
> > to unwind resource allocations in the reverse order that they were made.
> > And for goto labels to control how far to unwind.
> >
>
> You are right, thanks. Have to keep 'goto' structured, otherwise there
> would be a 'goto' mess.
>
> > So I think the following would be more in keeping with the intention of the
> > code. Even if it is a somewhat more verbose change.
> >
> > *compile tested only!*
>
> I'll test this on error paths and resend the patch.
Thanks, much appreciated.
next prev parent reply other threads:[~2023-02-01 16:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 19:19 [PATCH] net: openvswitch: fix flow memory leak in ovs_flow_cmd_new Fedor Pchelkin
2023-02-01 15:45 ` Simon Horman
2023-02-01 16:28 ` Fedor Pchelkin
2023-02-01 16:54 ` Simon Horman [this message]
2023-02-01 21:02 ` [PATCH v2] " Fedor Pchelkin
2023-02-02 8:11 ` Eelco Chaudron
2023-02-02 9:05 ` Simon Horman
2023-02-02 19:40 ` 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=Y9qZRCn7CLhYr5h3@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@google.com \
--cc=khoroshilov@ispras.ru \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pchelkin@ispras.ru \
--cc=pshelar@ovn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox