[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgcrEbFgkw9720H3tW-AhHOoEKhYwZinYJw4FpzSaJ6_Q@mail.gmail.com>
Date: Wed, 17 Nov 2021 15:38:59 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Kalesh Singh <kaleshsingh@...gle.com>
Subject: Re: [GIT PULL] tracing: Fix double free bug
On Wed, Nov 17, 2021 at 3:19 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On error, the operands and the histogram expression are destroyed,
> but since the destruction is recursive, do not destroy the operands
> if they already belong to the expression that is about to be destroyed.
Honestly, this seems horribly ugly.
The problem seems to be that the "goto error" cases are simply just wrong.
Why isn't the fix to make the error cases be the right ones, instead
of having one odd error case that then has to do some magic things to
not free the wrong things?
The patch ends up a bit bigger, mainly because I renamed the different
"free" cases, and because I made the non-freeing ones just return the
error directly.
Something like this (UNTESTED!) patch, IOW?
Linus
View attachment "patch.diff" of type "text/x-patch" (3339 bytes)
Powered by blists - more mailing lists