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: <9ba618c6-20aa-c9fd-dfef-1cef57168742@gmail.com>
Date:   Fri, 10 Sep 2021 11:25:14 -0500
From:   Ian Pilcher <arequipeno@...il.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     axboe@...nel.dk, pavel@....cz, linux-leds@...r.kernel.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        kabel@...nel.org
Subject: Re: [PATCH v2 11/15] leds: trigger: blkdev: Enable linking block
 devices to LEDs

On 9/10/21 1:48 AM, Greg KH wrote:
>> +/* Gets or allocs & initializes the blkdev disk for a gendisk */
>> +static int blkdev_get_disk(struct gendisk *const gd)
>> +{
>> +	struct ledtrig_blkdev_disk *disk;
>> +	struct kobject *dir;
>> +
>> +	if (gd->ledtrig != NULL) {
>> +		kobject_get(gd->ledtrig->dir);
> 
> When do you decrement this kobject?

That happens in blkdev_disk_unlink_locked() at line 399.  (Also in the
error path in blkdev_put_disk(), called at line 321.)

Looking at this now, blkdev_disk_unlink_locked() should be calling
blkdev_put_disk(), rather than calling kobject_put() directly.  I'll fix
that.

>> +static void blkdev_put_disk(struct ledtrig_blkdev_disk *const disk)
>> +{
>> +	kobject_put(disk->dir);
>> +
>> +	if (hlist_empty(&disk->leds)) {
>> +		disk->gd->ledtrig = NULL;
>> +		kfree(disk);
> 
> This should happen in the kobject release function, not here, right?

If you're referring to the kfree() call, it's freeing the
ledtrig_blkdev_disk structure, not the gendisk.  I use "gd" for gendisk
pointers and "disk" for ledtrig_blkdev_disk pointers.

> Did you try this out with removable block devices yet?

Absolutely.  I've tested removing both block devices and (user space)
LEDs.

-- 
========================================================================
                  In Soviet Russia, Google searches you!
========================================================================

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ