lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jzqfSniR8gzM6yO8Gx2-Av4ia0PYAGodmXqVsoNFvbZg@mail.gmail.com>
Date:   Fri, 3 Feb 2017 01:37:25 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Joe Perches <joe@...ches.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Wolfram Sang <wsa@...-dreams.de>
Subject: Re: [PATCH v4 3/4] device property: constify property arrays values

On Fri, Feb 3, 2017 at 1:16 AM, Dmitry Torokhov
<dmitry.torokhov@...il.com> wrote:
> On Fri, Feb 03, 2017 at 12:16:29AM +0100, Rafael J. Wysocki wrote:
>> On Thu, Feb 2, 2017 at 7:38 PM, Dmitry Torokhov
>> <dmitry.torokhov@...il.com> wrote:
>> > On Thu, Feb 02, 2017 at 07:52:58PM +0200, Andy Shevchenko wrote:
>> >> On Thu, 2017-02-02 at 09:07 -0800, Dmitry Torokhov wrote:
>> >> > On February 2, 2017 8:48:30 AM PST, Andy Shevchenko <andriy.shevchenko
>> >> > @linux.intel.com> wrote:
>> >> > > On Thu, 2017-02-02 at 08:39 -0800, Dmitry Torokhov wrote:
>> >> > > > From: Dmitry Torokhov <dmitry.torokhov@...il.com>
>> >> > > >
>> >> > > > Data that is fed into property arrays should not be modified, so
>> >> > >
>> >> > > let's
>> >> > > > mark
>> >> > > > relevant pointers as const. This will allow us making source
>> >> > > > arrays
>> >> > >
>> >> > > as
>> >> > > > const/__initconst.
>> >> > > >
>> >> > > > Also fix memory leaks on errors in property_entry_copy().
>> >> > >
>> >> > > While the code looks okay, I'm not sure what memory leaks you are
>> >> > > referring to. The idea as far as I remember was to run *free()
>> >> > > function
>> >> > > if *copy() fails.
>> >> >
>> >> > That could have been OK for internal function, but will not work for
>> >> > public API, as it goes against normal pattern.
>>
>> But it is an internal function, isn't it?
>>
>> Also its only caller does the right thing AFAICS.
>
> No, actually property_entries_dup() does not do the right thing anymore
> :(.

Well, it looks like this is because of patch [1/4], so IMO the changes
to clean up on errors in property_entry_copy() should be made in that
patch as well.

Right now we seem to have potential memory leaks introduced in patch
[1/4] and then fixed up in patch [3/4] in the same series which
doesn't feel quite right to be honest.

>>
>> >> > You will be old and grey and still correcting patches that would be
>> >> > getting it wrong :)
>> >>
>> >> Yes, which sounds not exactly as "we have memory leaks and here we are
>> >> fixing them". So, my comment regarding to phrasing of the commit
>> >> message. Someone might mistakenly think that it needs to be ported as
>> >> earlier as this had been introduced.
>> >
>> > OK, I'll leave it up to Rafael to massage the commit message as he sees
>> > fit.
>>
>> To be precise, there are no memory leaks and this is just adding an
>> unnecessary label along with some code around it, equally unnecessary.
>>
>> Are you planning on making property_entry_copy() non-static?
>
> Maybe, but not yet. Still, I am uncomfortable with functions not
> cleaning up but rather requiring leaving failed property structure in
> such state that cleanup function will not crash on it. I think it is
> fragile and I'd rather rework it so we clean up on the spot.

Fair enough, but that should happen in patch [1/4] already IMO.

Thanks,
Rafael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ