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:   Thu, 6 Apr 2017 17:08:42 +0300
From:   Leonard Crestez <leonard.crestez@....com>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>
CC:     <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
        "Boris Brezillon" <boris.brezillon@...e-electrons.com>,
        David Woodhouse <dwmw2@...radead.org>,
        Marek Vasut <marek.vasut@...il.com>,
        Dinh Nguyen <dinguyen@...nel.org>,
        Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>,
        Graham Moore <grmoore@...nsource.altera.com>,
        Enrico Jorns <ejo@...gutronix.de>,
        Chuanxiao Dong <chuanxiao.dong@...el.com>,
        "Masami Hiramatsu" <mhiramat@...nel.org>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Octavian Purdila <octavian.purdila@....com>
Subject: Re: [PATCH v3 33/37] mtd: nand: allocate aligned buffers if
 NAND_OWN_BUFFERS is unset

On Thu, Mar 30, 2017 at 11:15 AM, Masahiro Yamada <yamada.masahiro@...ionext.com> wrote:
> 
> Some NAND controllers are using DMA engine requiring a specific
> buffer alignment.  The core provides no guarantee on the nand_buffers
> pointers, which forces some drivers to allocate their own buffers
> and pass the NAND_OWN_BUFFERS flag.
> 
> Rework the nand_buffers allocation logic to allocate each buffer
> independently.  This should make most NAND controllers/DMA engine
> happy, and allow us to get rid of these custom buf allocation in
> NAND controller drivers.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>

> @@ -4914,8 +4930,12 @@ void nand_cleanup(struct nand_chip *chip)
> >         /* Free bad block table memory */
>         kfree(chip->bbt);
> -       if (!(chip->options & NAND_OWN_BUFFERS))
> +       if (!(chip->options & NAND_OWN_BUFFERS)) {
> +               kfree(chip->buffers->databuf);
> +               kfree(chip->buffers->ecccode);
> +               kfree(chip->buffers->ecccalc);
>                 kfree(chip->buffers);
> +       }

It seems that chip->buffers might not be allocated at this point, for
example if nand_cleanup is called during a failed probe. You should
check if (chip->buffers != NULL) before freeing stuff inside it.

When attempting to run linux-next on various imx6qdl-sabreauto boards
they now panic on boot. This happens because they have nand chips in
devicetree which are not physically populated on the board. This
normally fails in nand_scan_ident but now crashes later in
nand_cleanup.

--
Regards,
Leonard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ