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: <703338a4-4806-f919-9ed8-b06749b748b4@gmx.com>
Date:   Mon, 3 Aug 2020 15:33:58 +0800
From:   Qu Wenruo <quwenruo.btrfs@....com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Naresh Kamboju <naresh.kamboju@...aro.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux ACPI <linux-acpi@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Guenter Roeck <guenter@...ck-us.net>,
        "linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>
Subject: Re: [PATCH] kobject: Avoid premature parent object freeing in
 kobject_cleanup()



On 2020/8/3 下午3:27, Andy Shevchenko wrote:
> On Mon, Aug 3, 2020 at 10:25 AM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
>> On Mon, Aug 3, 2020 at 9:47 AM Qu Wenruo <quwenruo.btrfs@....com> wrote:
>>> On 2020/6/5 上午1:46, Rafael J. Wysocki wrote:
> 
>>>> +void kobject_del(struct kobject *kobj)
>>>> +{
>>>> +     struct kobject *parent = kobj->parent;
>>>> +
>>>> +     __kobject_del(kobj);
>>>> +     kobject_put(parent);
>>>
>>> Could you please add an extra check on kobj before accessing kobj->parent?
>>
>> I do not understand. Where do we access it?
>> kobject_put() is NULL-aware.
> 
> Ah, I see, now.
> 
> Should be something like
>     struct kobject *parent = kobj ? kobj->parent : NULL;

Exactly.

Thanks,
Qu

> 
>>> This patch in fact removes the ability to call kobject_del() on NULL
>>> pointer while not cause anything wrong.
>>>
>>> I know this is not a big deal, but such behavior change has already
>>> caused some problem for the incoming btrfs code.
>>> (Now I feels guilty just by looking into the old
>>> kobject_del()/kobject_put() and utilize that feature in btrfs)
>>>
>>> Since the old kobject_del() accepts NULL pointer intentionally, it would
>>> be much better to keep such behavior.
> 
> 



Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ