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] [day] [month] [year] [list]
Date:   Fri, 13 Oct 2017 15:44:06 -0500
From:   Rob Herring <robh+dt@...nel.org>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [PATCH] of: do not leak console options

On Fri, Oct 13, 2017 at 2:48 PM, Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
> On Tue, Oct 3, 2017 at 9:20 AM, Petr Mladek <pmladek@...e.com> wrote:
>> On Tue 2017-09-26 15:25:10, Sergey Senozhatsky wrote:
>>> Do not strdup() console options. It seems that the only reason for
>>> it to be strdup()-ed was a compilation warning: printk, UART and
>>> console drivers, for some reason, expect char pointer instead of
>>> const char pointer. So we can just pass `of_stdout_options', but
>>> need to cast it to char pointer. A better fix would be to change
>>> printk, console drivers and UART to accept const char `options';
>>> but that will take time - there are lots of drivers to update.
>>>
>>> The patch also fixes a possible memory leak: add_preferred_console()
>>> can fail, but we don't kfree() options.
>>>
>>> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
>>
>> Of course, it would be better to change add_preferred_console().
>> But it would trigger many other changes. This alternative
>> "temporary" change looks safe to me. Feel free to use
>
> Really? Unless I'm missing something (it's been way too many hours after my
> morning coffee), add_preferred_console() just calls __add_preferred_console(),
> and the latter doesn't touch the passed string. As passing a "char *" to a
> function that excepts a "const char *" is fine, you can just add "const" to
> both add_preferred_console() and __add_preferred_console(), and be done with
> it.

You've only moved the cast down one level. See the prior
discussion[1]. It gets passed to match and setup functions of the
console drivers none of which actually modify the string, but it's
just a lot of drivers to go fix. Maybe someone wants to write a
coccinelle patch.

Anyway, it's in Linus' tree now.

Rob

[1] https://lkml.org/lkml/2017/8/25/784

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ