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]
Date:   Fri, 10 Sep 2021 10:00:23 -0500
From:   Ian Pilcher <arequipeno@...il.com>
To:     Marek BehĂșn <kabel@...nel.org>
Cc:     axboe@...nel.dk, pavel@....cz, linux-leds@...r.kernel.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        gregkh@...uxfoundation.org
Subject: Re: [PATCH v2 04/15] block: Add block device LED trigger integrations

On 9/9/21 8:23 PM, Marek BehĂșn wrote:
> On Thu,  9 Sep 2021 17:25:02 -0500
> Ian Pilcher <arequipeno@...il.com> wrote:
>> Call ledtrig_blkdev_disk_init() from device_add_disk() to ensure that
>> ledtrig is initialized to NULL, in case a driver allocates the structure
>> itself and doesn't use kzalloc()
> 
> No, this is not needed. If someone does not use kzalloc(), they should
> use it. No need to fix other code here.

Yeah.  I'm honestly not sure if this is necessary or not, as I don't
know if there are any drivers that actually have this problem.  I
decided to include this for now, because an uninitialized pointer can
cause memory corruption, etc., when the disk cleanup function follows a
garbage pointer.

This recent commit seems to indicate that until recently drivers were
responsible for doing gendisk allocation.

> commit f525464a8000f092c20b00eead3eaa9d849c599e
> Author: Christoph Hellwig <hch@....de>
> Date:   Fri May 21 07:50:55 2021 +0200
> 
>     block: add blk_alloc_disk and blk_cleanup_disk APIs
>     
>     Add two new APIs to allocate and free a gendisk including the
>     request_queue for use with BIO based drivers.  This is to avoid
>     boilerplate code in drivers.

Were those drivers expected to use kzalloc() or otherwise zero out the
entire structure?  I really don't know.

I think that it makes sense to defer to the block subsystem maintainers
on this question.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ